-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Refactor macOS text editing shortcuts #110289
Conversation
@justinmc @Renzo-Olivares This is ready for review |
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 line 352/353 go under an _iOSDisablingShorcuts
or is that not within the scope of the PR?
// | ||
// 1. Shortcuts fired when an EditableText is focused are ignored and | ||
// forwarded to the browser by the EditableText's Actions, because it | ||
// forwarded to the platform by the EditableText's Actions, because it | ||
// maps DoNothingAndStopPropagationTextIntent to DoNothingAction. | ||
// 2. Shortcuts fired when no EditableText is focused will still trigger | ||
// _shortcuts assuming DoNothingAndStopPropagationTextIntent is | ||
// unhandled elsewhere. | ||
result = Shortcuts( | ||
debugLabel: '<Web Disabling Text Editing Shortcuts>', |
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.
Nit: Web
-> Platform
I am not sure if i understand, can you explain a bit more? |
I want to make sure I understand what is happening in this PR.
I'm not fully understanding how these changes, allows a widget other than editable text to handle the macOS text editing shortcuts. Do you mind clarifying for my sake? |
I considered those lines also as
So what I was suggesting was something like
Edit: looks like those two lines are common to windows/linux/android/fuschia/and iOS and remove the two shortcuts from the default iOS mapping. But this PR only targets macOS, so I understand if you weren't planning on doing that. |
The goal I am trying to achieve is that. on macOS or web
There are still a lot of hidden requirement, but those are use cases based to achieve this. I created two shortcuts, inner one(disabling) and outer one(real shortcut) Let's consider two examples:
|
Thank you for the explanation. I think I understand both examples. I would have thought example 2 was already possible before this change if EditableText did not have focus, is this not true? I thought the widget that receives the KeyEvent is the one focused, if that focused widget does not have a Shortcuts -> Intent mapping that handles the KeyEvent, then that KeyEvent is bubbled up. So if something above EditableText has focus it will receive the KeyEvent, and that will bubble up to the nearest Shortcut widget. Who will call Actions.maybeFind(primaryFocus?.context, matchedIntent) to find the appropriate Action in the Intent -> Actions mapping for the widget with focus. |
before this change macos doesn't have a shortcut for arrow key at all, so no intent will be fired. |
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.
LGTM. Thank you for the explanations!
This pr enables widgets other than editable text to handle macos text editing shortcut.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.