-
Notifications
You must be signed in to change notification settings - Fork 1.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
IndentPlugin stops FOCUS_COMMAND
propagation in Lexical
#10049
Comments
I guess you meant the opposite. The thing is that if we do that and then we add Firefox to playwright config which is where bug #8654 happened:
and you run the test that introduced that PR in Firefox, it will fail:
So either we make people register the command with a priority higher than Honestly, I'm inclined to undo the above PR. It seems more Firefox's responsibility than ours, it makes our code more complex and limits what users can do. Also, there are other places where indent doesn't allow you to escape the editor anyway as explained in that PR. What do you think? |
I originally created that PR and I'm not against the idea of reverting it, I do agree it adds complexity. The reverted functionality can be revisited more broadly when we attempt to fix the trapped focus in the other parts of the editor that affect all browsers through the use of the toggle indent idea. |
Doing that! |
Describe the Bug
The recently introduced command listener by
IndentPlugin
stops the propagation of theFOCUS_COMMAND
in Lexical.This means that only plugins that register their
FOCUS_COMMAND
listeners at theCOMMAND_PRIORITY_NORMAL
level or above will work.I recommend returning
true
from the registered listener instead offalse
. This way we allow propagation down to other handler.Listeners that run at a higher priority can "intercept" commands and prevent them from propagating to other handlers by returning true. - according to Lexical Docs
Link to the code that reproduces this issue
https://github.com/rolandsaven/payload-lexical-indent-plugin
Reproduction Steps
Use this branch to test. I've created a plugin that register logging listeners and fails to log at a certain level here -> https://github.com/rolandsaven/payload-lexical-indent-plugin/blob/main/src/lexical/features/focus/plugin.tsx#L20
git clone [email protected]:rolandsaven/payload-lexical-indent-plugin.git
(comes with SQLITE db)cd payload-lexical-indent-plugin
pnpm install
pnpm run dev
Which area(s) are affected? (Select all that apply)
plugin: richtext-lexical
Environment Info
The text was updated successfully, but these errors were encountered: