-
Notifications
You must be signed in to change notification settings - Fork 3
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
UIQM-592 Fix input polish chars into fields #726
Conversation
@@ -465,6 +465,10 @@ const QuickMarcEditor = ({ | |||
name: 'save', | |||
shortcut: 'mod+s', | |||
handler: async (e) => { | |||
if (['ctrl', 'alt'].every(x => e.pressedKeys.includes(x))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@przemyslawturek please add a comment explaining that ctrl+alt+S is a combination for Ś
, so to prevent the saving we need to check for this combination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will block all ctrl+alt+...
key combinations. Maybe this will fix the issue:
function isPolishDiacritic(char) {
const polishDiacriticRegex = /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/;
return polishDiacriticRegex.test(char);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way is to check if the character is a diacritical character and if so, prevent the action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to detect diacritical characters is more universal for other languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth revising this approach too folio-org/ui-inventory#2350.
Added utils function to detect diacritics chars - polish, romanian, czech etc. In polish ł, Ł chars is special diactritics that is not normalized char to l, L.
Quality Gate passedIssues Measures |
Purpose
Problem detected only on windows with polish programmer keyboard installed (default for polish).
No issue detected on Mac or Linux.
Prevent execute action for ex. "Save record" triggered from shortcut ctrl + s when inputing polish special chars ś or Ś.
Approach
Detects pressing the ctrl and alt keys and interrupts shortcut actions.
Issues
UIQM-592
ScreenRecords
Before changes
Before_UIQM-592.mp4
After changes
After_UIQM-592.mp4