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

"Select all" selects UI text #1

Closed
Radiergummi opened this issue Mar 27, 2018 · 2 comments
Closed

"Select all" selects UI text #1

Radiergummi opened this issue Mar 27, 2018 · 2 comments

Comments

@Radiergummi
Copy link

You can see this with the background color picker. Might apply user-select: none to the UI?

@ismail9k
Copy link

Thank you for your feedback,
Selecting all UI text is the default browser behavior when pressing Ctrl + A / ⌘ + A .
While the default Align's behavior is to select the current section contents.
this will work fine if you click on select all button, but while the background color picker is open you are no longer focused on the Align's editor so the default browser behavior wont be prevented.
applying user-select: none hack will not work in this situation, I think the fix will be to add listener to the document to prevent that action

    document.addEventListener('keydown', (event) => {
      // Do nothing if the event was already processed
      if (event.defaultPrevented) {
        return;
      }
      if (event.ctrlKey || event.metaKey) {
        switch (event.key.toUpperCase()) {
          case 'A':
            event.preventDefault();
          break;
        }
      }
    });

@Radiergummi
Copy link
Author

I actually clicked the select all button, then opened the color picker and all input fields were selected.
Your fix looks like it'd solve the problem you outlined anyway so it might make sense to implement that nevertheless 😄

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