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

Selected MenuItem loses background when focused and becomes unreadable #7200

Closed
acmertz opened this issue Apr 21, 2021 · 1 comment · Fixed by #7202
Closed

Selected MenuItem loses background when focused and becomes unreadable #7200

acmertz opened this issue Apr 21, 2021 · 1 comment · Fixed by #7202

Comments

@acmertz
Copy link
Contributor

acmertz commented Apr 21, 2021

Description

When you select a MenuItem, its text and background colors change to clearly indicate which item is selected (as expected). However, if the MenuItem receives mouse focus while in this state, its background color reverts to transparent but the dark text remains, making it very difficult to read.

https://codepen.io/acmertz/pen/gOgQWZV

Steps to reproduce

  1. Hover over a MenuButton in the control bar that has a menu associated with it (for example, the Captions button)
  2. Click on the MenuItem that is currently selected. Notice how the background briefly reverts back to transparent before the Menu disappears, while the text color remains dark.
  3. Hover over the MenuButton again. The selected item still has dark text on a dark background.

If the currently selected MenuItem is also the first item in the Menu, then this issue is also easily reproducible by simply clicking the MenuButton so the Menu is locked in its "opened" state. This immediately sets focus to the first (and currently selected) MenuItem and thus reverts the background styles.

Results

Expected

The selected MenuItem always has a white background and dark text.

Actual

If a MenuItem is selected and also has focus, it has dark text on a dark background.

Additional Information

The bug does not occur if you trigger the Menu via your keyboard. The :focus:not(:focus-visible) selector used in the Menu styles appears to be conflicting with the MenuItem's "selected" styles. This looks related to #5558 and #7712.

Versions

Video.js

v7.11.8

Browsers

Chrome/Edge, Firefox

OS

Windows

Plugins

None

@gkatsev
Copy link
Member

gkatsev commented Apr 21, 2021

I guess there's more work to do on top of #7713 😆

acmertz added a commit to acmertz/video.js that referenced this issue Apr 22, 2021
Use :not() pseudo-class to avoid resetting selected MenuItem style
Fixes videojs#7200
acmertz added a commit to acmertz/video.js that referenced this issue Apr 22, 2021
Use :not() pseudo-class to avoid resetting selected MenuItem style
Fixes videojs#7200
acmertz added a commit to acmertz/video.js that referenced this issue Apr 22, 2021
Adds a :not() pseudo class to ensure that the MenuItem background color doesn't get incorrectly reset on mouse focus.
Fixes videojs#7200
gkatsev pushed a commit that referenced this issue May 11, 2021
Adds a :not() pseudo class to ensure that the MenuItem background color doesn't get incorrectly reset on mouse focus.

Fixes #7200
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
edirub pushed a commit to edirub/video.js that referenced this issue Jun 8, 2023
Adds a :not() pseudo class to ensure that the MenuItem background color doesn't get incorrectly reset on mouse focus.

Fixes videojs#7200
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants