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 alt menu for firefox #15267

Merged

Conversation

light-and-ray
Copy link
Contributor

@light-and-ray light-and-ray commented Mar 15, 2024

Description

Firefox opens menu bar in the top of window "File, Edit, View, etc" by default. It can be disabled by https://support.mozilla.org/en-US/questions/1278533. But I think it's better to just prevent defaults for alt key at all

Screenshots/videos:

Screenshot_20240315_120242

Checklist:

@AUTOMATIC1111
Copy link
Owner

This is unrelated to webui and should be handled by firefox extensions.

@light-and-ray
Copy link
Contributor Author

light-and-ray commented Mar 16, 2024

Why? Many web apps block this behavior because it's default for firefox. And what did you mean by firefox extensions?

@AUTOMATIC1111
Copy link
Owner

This applies globally to firefox, not to web ui. What you need is a firefox extension that will disable this globally.

@light-and-ray
Copy link
Contributor Author

Not truth, it applies only for webui tab. E.g. photopea does the same. Look my patch, it just prevents default for alt

fdhggfhg.mp4

@light-and-ray
Copy link
Contributor Author

I think it's very nessasary patch because it breaks zooming with default alt key. It cancels after uping alt key

dfsg.mp4

@AUTOMATIC1111
Copy link
Owner

Can anyone else confirm this? For me, alt+mouse wheel works fine in Firefox 123.0.1 (64-bit).

@light-and-ray
Copy link
Contributor Author

light-and-ray commented Mar 16, 2024

Hm, maybe in windows it's disabled by default? Which variable have been set in about:config -> menuAccessKeyFocuses. I had this problem right after I started using the webui. And it appears on 2 devices

@AUTOMATIC1111
Copy link
Owner

The key is true for me, but the menu is also always visible. The File menu gets focused when I release alt, but it does not interfere with zooming.

@light-and-ray
Copy link
Contributor Author

It because in your case there is no resize event

@AUTOMATIC1111
Copy link
Owner

I can reproduce the problem now, after removing the menu, but disabling entire alt key because of just zoom is not right. Plus, wouldn't the code as it is now fail if you hold alt, press another key, release another key, then release alt?

@light-and-ray
Copy link
Contributor Author

disabling entire alt key because of just zoom is not right

I don't think so. I think it's okay to override browser's defaults for webapp

But it's your choice. How I can apply this event listner only for image box? Maybe add event lisner on targetElement instead of document

Plus, wouldn't the code as it is now fail if you hold alt, press another key, release another key, then release alt?

No, I tested it, and have retested it again. If I press something after alt, and then release alt, the menu isn't opened even on other pages

@light-and-ray
Copy link
Contributor Author

Made it, now alt is being suppressed only if the key in config is "Alt" and mouse was inside image

There is one problem, if you press alt outside image, then move mouse inside, and start zooming, menu will appear. But I think nobody presses alt before move mouse inside image

@AUTOMATIC1111
Copy link
Owner

Is it not possible to check for e.code in the release event?

@light-and-ray
Copy link
Contributor Author

Yes, it can fix it. I forget about it. Pushed
keydown event is still needed for case alt was pressed inside zone, but released outside, what is a popular scenario

@AUTOMATIC1111 AUTOMATIC1111 merged commit 2f9d1c3 into AUTOMATIC1111:dev Mar 16, 2024
3 checks passed
@light-and-ray light-and-ray deleted the prevent_alt_menu_on_firefox branch March 17, 2024 01:43
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.

None yet

2 participants