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

Ignore key events (specifically arrow keys) if a modifier key is down #222

Closed
skfoo opened this issue Aug 19, 2023 · 3 comments
Closed

Ignore key events (specifically arrow keys) if a modifier key is down #222

skfoo opened this issue Aug 19, 2023 · 3 comments

Comments

@skfoo
Copy link

skfoo commented Aug 19, 2023

The web ui supports using alt+up/down to change the weights of the selected text/lora, however this also activates the tag autocomplete popup at the same time.

Is there any reason for the code to respond to arrow keys while alt/shift/control are pressed? It looks like you can just exit early in tagAutocomplete.js' navigateInList function if event.getModifierState indicates that any modifiers are down.

@DominikDoom
Copy link
Owner

I'm not sure what your issue is, I already do exactly that. See the following line:
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/blob/main/javascript/tagAutocomplete.js#L1116-L1117
It uses the direct event vars instead of getModifierState, but for this case it should be functionally identical.

It will not force-close the popup if it is already open, but at least for weight editing this happens automatically for me due to the text change. And it definitely stops the list from capturing the key press. Works as intended for me:

chrome_2023-08-19_11-31-21.mp4

Also as a side note, at least in the default webui weight editing is only possible with CTRL, and ALT for switching the position of the selected word in the prompt. You can't change it to ALT for weight editing there. Are you using a fork?

@skfoo
Copy link
Author

skfoo commented Aug 19, 2023

Are you using a fork

No I'm using a Mac. I meant Control. This is what happens; Auto1 version 1.5.2 with the latest Chrome.

Screen.Recording.2023-08-19.at.2.48.49.AM.mov

Don't know why the popup isn't showing up near the text cursor, it was doing that properly before.

Edit: I added || event.metaKey to the line and now it's probably working as intended. The command key is used instead of control to change weights, and that's the metaKey to Javascript.

@DominikDoom
Copy link
Owner

Ah, I think I see the issue now. The mac command key is event.metaKey, not event.ctrlKey, which I didn't catch before.
I believe it should be fixed now. I don't have a mac to try it out myself, so feel free to reopen if it still has issues.

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

No branches or pull requests

2 participants