-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocks: Reselect the current block if we click again on it #556
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,14 +137,13 @@ class VisualEditorBlock extends wp.element.Component { | |
wrapperProps = settings.getEditWrapperProps( block.attributes ); | ||
} | ||
|
||
// Disable reason: Each block can receive focus but must be able to contain | ||
// block children. Tab keyboard navigation enabled by tabIndex assignment. | ||
// Disable reason: Each block can be selected by clicking on it | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes here break tab navigation:
Expected: Image block is selected The disable reason doesn't seem acceptable for accessibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 11d81e4 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the comment be reverted back to its previous text? Or at least updated to reflect that it accepts focus? Seems like suggesting "clicking on it" as reason for disabling an accessibility rule is destined to... provoke response 😄 |
||
|
||
/* eslint-disable jsx-a11y/no-static-element-interactions */ | ||
/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/onclick-has-role */ | ||
return ( | ||
<div | ||
ref={ this.bindBlockNode } | ||
tabIndex="0" | ||
onClick={ onSelect } | ||
onFocus={ onSelect } | ||
onBlur={ this.maybeDeselect } | ||
onKeyDown={ onStartTyping } | ||
|
@@ -153,6 +152,7 @@ class VisualEditorBlock extends wp.element.Component { | |
onMouseLeave={ onMouseLeave } | ||
className={ className } | ||
data-type={ block.blockType } | ||
tabIndex="0" | ||
{ ...wrapperProps } | ||
> | ||
{ ( ( isSelected && ! isTyping ) || isHovered ) && <BlockMover uid={ block.uid } /> } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow this. Why does the value of
this.props.value
differ fromprevProps.value
after theonChange
? And if it does, why do we not want this to be reflected in the editable?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you make a change on the editable. Say the old value is
a
and the new one isab
, we don't want to trigger theupdateContent
even if the old value prop and the new one are different. That's what I'm trying to achieve here by caching thesavedContent
.