-
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
Conversation
93a9f73
to
d95c03c
Compare
Works really well. I'm experiencing a strange bug where, if I click on a block to show the controls, and then click on another, the caret appears on the start instead of the letter clicked. |
I was seeing a similar thing but triggered by clicking on one of the formatting buttons repeatedly (three times on italics without pressing any other key). |
@@ -137,15 +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 comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here break tab navigation:
- Focus text block
- Press tab
Expected: Image block is selected
Actual: Third block (next text 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 comment
The 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 comment
The 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 😄
@@ -266,10 +268,13 @@ export default class Editable extends wp.element.Component { | |||
this.focus(); | |||
} | |||
|
|||
// The savedContent var allows us to avoid updating the content right after an onChange call |
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 from prevProps.value
after the onChange
? 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 is ab
, we don't want to trigger the updateContent
even if the old value prop and the new one are different. That's what I'm trying to achieve here by caching the savedContent
.
11d81e4
to
b8f7505
Compare
closes #498
This PR allows reselecting a block (showing the controls) when clicking on the block again.
Testing instructions