Support normalizing access keys in dialog buttons #8308

merged 3 commits into from Jan 6, 2017


None yet

3 participants

kevinsawicki commented Dec 29, 2016 edited

This pull requests adds a new option to dialog.showMessageBox API called normalizeAccessKeys that, when true, will convert all the button labels to have the correct special character access keys on each platform.

This option is off by default to not break existing apps. It could be switched to true by default in 2.0.

& is used as the default access key since that is the Window standard. That value is then converted to _ on Linux since that is the GTK convention.

&& can be used for escaped values.

Access keys are removed when on macOS since there isn't support for them there.

Below is a table of the normalized values when this option is specified:

Button Text macOS Windows Linux
Hello Hello Hello Hello
He&llo Hello He&llo He_llo
Contact R&&D Contact R&D Contact R&&D Contact R&D
Contact R&&&D Contact R&D Contact R&&&D Contact R&_D
Contact R&&&&D Contact R&&D Contact R&&&&D Contact R&&D
Chee&rs ^_^ Cheers ^_^ Chee&rs ^_^ Chee_rs ^__^

/cc @damieng just want to confirm with you this looks good for Atom's use cases.

Closes #7517

damieng commented Dec 30, 2016

This looks great, thanks!



kevinsawicki added some commits Dec 29, 2016
@kevinsawicki kevinsawicki Add option to normalize dialog access keys eb533e0
@kevinsawicki kevinsawicki Document normalizeAccessKeys option d200cf2
@kevinsawicki kevinsawicki Access directly on options object
@kevinsawicki kevinsawicki merged commit 0a7dccb into master Jan 6, 2017

8 of 9 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/appveyor/pr AppVeyor build succeeded
electron-linux-arm Build #5112721 succeeded in 94s
electron-linux-ia32 Build #5112722 succeeded in 87s
electron-linux-x64 Build #5112723 succeeded in 156s
electron-mas-x64 Build #3113 succeeded in 8 min 49 sec
electron-osx-x64 Build #3127 succeeded in 9 min 28 sec
electron-win-ia32 Build #2161 succeeded in 13 min
electron-win-x64 Build #2148 succeeded in 13 min
@kevinsawicki kevinsawicki deleted the normalize-access-keys branch Jan 6, 2017
@kevinsawicki kevinsawicki referenced this pull request in atom/atom Jan 10, 2017

Upgrade Electron to v1.4.x #12696

0 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment