-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(#17820): prevent event propagation to browser history when clicki… #22523
Conversation
…ry when clicking on entity state
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.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
After more testing I can see this is not working as expected. |
This is a partial fix to bug #17820 which pushes 4 items to the browser history when clicking on the state object in the lovelace GUI.
It's only a partial fix because in my local (very limited) testing this change appears to reduces this number from 4 to 2.
As it is a small change, I wanted to raise this PR to get some early feedback as I am not a frontend webdev, but it is such a hot-button topic that so many users are complaining about, and from my investigations it looked like it should be a pretty simple issue to fix so I wanted to give it a try.
I think I can complete the fix so that only a single item is pushed to the browser history, but it would be nice to have some feedback from some proper frontend webdevs.
Proposed change
The fix partially prevents duplicate history entries by adding a new
_handleValueAction
method that checks if the action event originated directly from the value div or its immediate state child div. Event propagation is also stopped to prevent any potential bubbling that could trigger multiple history updates.Type of change
Example configuration
None
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: