-
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
Changing a RichText value automatically focus the RichText #17505
Comments
This looks like high priority for me as it may have broken a lot of plugins. Any ideas how we can solve it? |
I don't think RichText regressed it probably was always like that when a change happens the RichText gets focus. The problem is that if we want to keep the behavior of closing popovers when the focus is outside them we need to change this RichText behavior. I tested a third-party plugin "Mighty Blocks" and its functionality to choose a background or text color partially in a paragraph is affected as expected and the color picker popover closes every time a "color move" happens making it very hard to use. |
I’ll look into it asap. |
I see now in the instructions to focus RichText, then focus outside, but this was the behaviour before as well? Could you share the user experience that is currently broken with the popovers you mention? |
@ellatrix The custom color selection in this pull request of mine : #16014 You could also try the issue on this plugin of yours : https://wordpress.org/plugins/advanced-rich-text-tools/ . The custom color picker selection is closing automatically. Let me know your thoughts. Thanks! |
Hi @ellatrix, yes to reproduce the focus needs to be inside RichText, and then programmatically focus another element, when the rich text changes even if the user did not interact with it (programmatic change) the RichText will get focused. |
When was the change to popovers introduced? I'll think about it. Some buttons do rely on rich text gaining focus after a change. |
I think it was introduced in this PR #14851. More or less eight weeks ago. |
@ellatrix @jorgefilipecosta Found another issue which is probably related to RichText focus. I'm trying to display Here's the screenshot where the cursor is still on the RichText even if Modal is opened. Working on the core editor though : |
Checked the issue with @ellatrix Do you by any chance created function that I can use to remove/reset focus from RichText? Thanks! |
Describe the bug
Currently, if we change a RichText value the RichText gets focused and becomes the active element event if another element was focused and rich text value is changed using a programmatic interface e.g:
wp.data.dispatch( 'core/block-editor' ).updateBlockAttributes( block.clientId, { content: '1<strong>234</strong>56789' } );
.Previously the popover was closed when a click outside them happened; now they are closed when the focus is outside them. This change makes the rich text automatically gaining focus problem worse. For example, if we have popover with a SelectControl that allows switching the content of a paragraph between some predefined values when the select is used, the popover closes.
Another side effect is that on PR #16014 that adds custom color as a format, each time we try to use the color picker the popover closes, because when we use the color picker there is a change in the format leaving to a change to the content of paragraph and making the focus go outside the popover.
I guess we should address this issue before WordPress 5.3 because this problem may affect third-party plugins that add color options or even other option in a popover.
I guess we may also have a11y related problems with moving the focus.
To reproduce
Steps to reproduce the behavior:
Focus some element on the page (and verify it gets focused):
cc: @ellatrix
The text was updated successfully, but these errors were encountered: