-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RichText: Do not focus the input unless user is in an editing context #61374
Open
alexstine
wants to merge
4
commits into
trunk
Choose a base branch
from
fix/61315
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3c08c2e
Remove hacky focus fix to prevent the canvas from taking focus.
alexstine 80c2e63
Every time a user types, virtual text tree is created. This could cau…
alexstine c3a0213
Better code comment.
alexstine 1976d51
Refresh and reviewer feedback.
alexstine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We need the
activeElement.focus()
on line 304 to run for Firefox to move focus after a selection change.When that change comes from the toolbar (indent/outdent), we want the cursor to get applied to the list item and take focus. When a change comes from the sidebar, we don't want to move focus to the canvas (like a navigation label text change). I can't find a way to differentiate between these two situations. Fixing one breaks the other.
@ellatrix, do you have any insights?
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 failing to understand what problem this modification to rich text solves. I remove this change, tried to edit the text in the inspector for a navigation link, and focus seems to remain there. How do I reproduce the problem without this change to rich text?
These lines in rich text are only meant to maintain focus only if the active element right before changing the range is different after changing the range.
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.
On Trunk in Chrome:
Screen.Recording.2024-06-28.at.9.25.15.AM.mov
On this PR in Firefox
Screen.Recording.2024-06-28.at.9.29.14.AM.mov
This PR without the
isInsideFrame
check in FirefoxScreen.Recording.2024-06-28.at.9.30.49.AM.mov
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.
@ellatrix Did Jerry's response answer your queries?