Skip to content
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

Prevent bookmark popup flickering when clicking paragraphs with trailing bookmarks. #17690

Conversation

Mati365
Copy link
Member

@Mati365 Mati365 commented Dec 23, 2024

Suggested merge commit message (convention)

Fix (bookmark): Prevent bookmark popup flickering when clicking paragraphs with trailing bookmarks.


Additional information

When a widget (e.g., a bookmark anchor) is clicked, two consecutive update events may fire:

  1. First, when the widget gets focused (this is fine)
  2. Second, when the selection changes shortly after (beware, dragons live here)

While the widget usually stays selected, sometimes the selection may move to a different element (e.g., to the start of the parent paragraph). This can cause the toolbar to flicker as it's quickly shown and hidden.

This issue particularly affects widgets like anchors that contain a single SVG element.

Making the element inline-block seems to reduce flickering.

Before

2024-12-23.10-11-39.mp4

After

after-fix-2024-12-23_16.41.38.mp4

Copy link
Contributor

@niegowski niegowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest fixing the bookmark stylesheet instead. Adding display: inline-block; to the .ck-bookmark.ck-widget selector should fix the problem.

@Mati365
Copy link
Member Author

Mati365 commented Jan 8, 2025

@niegowski I checked this, and it's not.

selection-bug-2025-01-08_07.09.51.mp4

@pszczesniak
Copy link
Contributor

Fix that @niegowski suggested doesn't eliminate it completely, but it limits it more.

It also fixes issue shown on the video (clicking at the end of paragraphs):

Screen.Recording.2025-01-08.at.09.28.16.mov

@Mati365 Mati365 force-pushed the ck/epic/17230-linking-experience-wrong-selection branch from 05c4cc8 to 6e8099f Compare January 8, 2025 08:53
@Mati365 Mati365 force-pushed the ck/epic/17230-linking-experience-wrong-selection branch from 6e8099f to ac1d811 Compare January 8, 2025 08:54
@Mati365 Mati365 requested a review from niegowski January 8, 2025 08:56
… - selection can be placed before a bookmark.
@niegowski
Copy link
Contributor

Please update the PR title.

@Mati365 Mati365 changed the title Add ability to debounce of the toolbar show in the WidgetToolbarRepository due to Google Chrome selection quirks. Prevent bookmark popup flickering when clicking paragraphs with trailing bookmarks. Jan 9, 2025
@Mati365 Mati365 merged commit 40bed92 into ck/epic/17230-linking-experience Jan 9, 2025
6 of 7 checks passed
@Mati365 Mati365 deleted the ck/epic/17230-linking-experience-wrong-selection branch January 9, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants