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

Disable dim-bots only when clicking on empty areas #6910

Merged
merged 3 commits into from
Sep 17, 2023
Merged

Conversation

fregante
Copy link
Member

This was annoying to do until now: ctrl-click multiple PRs.

This PR makes 2 changes:

  • the bots won't undim when clicking on active elements
  • the bots won't undim when pressing any keys
Screen.Recording.mov

Test URL

https://github.com/mozilla/web-ext/pulls

@fregante fregante added the bug label Sep 13, 2023
@@ -58,9 +63,6 @@ function init(signal: AbortSignal): void {

// Undim on mouse focus
delegate(dimBots.selector, 'click', undimBots, {signal});

// Undim on keyboard focus
document.documentElement.addEventListener('navigation:keydown', undimBots, {once: true, signal});
Copy link
Member Author

Choose a reason for hiding this comment

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

Because GitHub crippled this event, I just have to drop it. There's no way to distinguish between an actual navigation and the mere pressing of the ctrl key. So, nothing, I'm not going to rewrite their logic to detect actual j/k navigation.

@@ -7,7 +7,7 @@ const html = document.documentElement;

function init(): void {
html.setAttribute(attribute, '');
html.addEventListener('navigation:focus', () => {
html.addEventListener('navigation:keydown', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Bonus bugfix: likewise, just hovering an item focuses the item, so I had to change it to at least keydown (not perfect, but not as noticeable as in dim-bots)

@fregante fregante merged commit 15e1ce7 into main Sep 17, 2023
10 checks passed
@fregante fregante deleted the better-dim-bots branch September 17, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

1 participant