Skip to content

Commit

Permalink
fix: browser detection of Edge
Browse files Browse the repository at this point in the history
Signed-off-by: Till Sanders <mail@till-sanders.de>
  • Loading branch information
tillsanders committed Jan 10, 2021
1 parent 2311712 commit ae8239d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Chrome is still missing out. To help bridge the gap, you can use this polyfill a
users benefit from the keyboard shortcuts you provide!

[**Demo**](https://tillsanders.github.io/access-key-label-polyfill/)
[**Full length article** about accessKey and accessKeyLabel on dev.to](https://dev.to/tillsanders/boy-was-it-hard-to-implement-proper-keyboard-shortcuts-4d72)

## Usage

Expand Down Expand Up @@ -90,4 +91,14 @@ return the correct label. You can then use `accessKeyLabel` as expected.
browsers, that need this polyfill, but there is surprisingly little information regarding support,
so please feel free to open an issue if you come across an unsupported case.
- Chrome on Android does not seem to support `accessKey`, or at least, I was unable to guess (why
is this not documented anywhere?!) the correct modifier keys. Would love to get help with this!
is this not documented anywhere?!) the correct modifier keys. Would love to get help with this!

# Changelog

## 0.1.1 – (10.01.2021)

- Fix browser detection of Edge

## 0.1.0 – (09.01.2021)

- Initial implementation
2 changes: 1 addition & 1 deletion demo/AccessKeyLabelPolyfill.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/AccessKeyLabelPolyfill.umd.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/determineAccessKeyLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function determineAccessKeyLabel(ua: string): string | undefined
}

// Internet Explorer / Edge
if (ua.match(/msie|trident/i) || ua.match(/\sedge/i)) {
if (ua.match(/msie|trident/i) || ua.match(/\sedg/i)) {
return 'Alt + ';
}

Expand Down
2 changes: 1 addition & 1 deletion test/AccessKeyLabelPolyfill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('AccessKeyLabelPolyfill', () => {
},
{
// Windows, Edge
test: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763',
test: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edg/18.17763',
expectedModifiers: 'Alt + ',
},
{
Expand Down

0 comments on commit ae8239d

Please sign in to comment.