-
Notifications
You must be signed in to change notification settings - Fork 355
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
Infrastructure: Update skipto.js to fix shortcut key bug for non-english keyboard layouts #2975
Conversation
I have updated the pull request with SkipTo.js version 5.3.1 which disables the shortcut key when focus is on text input element. For code changes see the Test page: |
@howard-e |
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.
@jongund thanks for the continued improvements to the script, as well as the detailed information on what's changed and how to test! I was able to verify the discussed change works as expected across both Windows and MacOS for several browsers.
I've left non-blocking feedback inline and a question that could be discussed separately.
content/shared/js/skipto.js
Outdated
!event.metaKey; | ||
|
||
if ((optionPressed && this.config.optionShortcut === event.key) || | ||
(altPressed && this.config.altShortcut === event.key) || |
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.
(altPressed && this.config.altShortcut === event.key) || | |
(altPressed && this.config.altShortcut === event.key) || |
Minor nit that may not matter if this was a stylistic choice coming from the formatter in the source repository.
content/shared/js/skipto.js
Outdated
@@ -9,6 +9,7 @@ | |||
* Neither the name of PayPal or any of its subsidiaries or affiliates, nor the name of the University of Illinois, nor the names of any other contributors contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* CDN: https://skipto-landmarks-headings.github.io/page-script-5/dist/skipto.min.js | |||
* Documenation: https://skipto-landmarks-headings.github.io/page-script-5 |
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.
* Documenation: https://skipto-landmarks-headings.github.io/page-script-5 | |
* Documentation: https://skipto-landmarks-headings.github.io/page-script-5 |
@@ -9,6 +9,7 @@ | |||
* Neither the name of PayPal or any of its subsidiaries or affiliates, nor the name of the University of Illinois, nor the names of any other contributors contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* | |||
* CDN: https://skipto-landmarks-headings.github.io/page-script-5/dist/skipto.min.js |
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.
Moving to the minified version of this script in the future could be great to reduce load.
Although subsequent reviews for updates in this repository would now only be functional and maybe require reviewing changes after the fact in the source repository, when necessary. I wonder how others may feel about that for this script?
(this feedback is not suggesting any further changes to this PR)
When I open the menu, either by tabbing to it or with the shortcut key, most of the time the focus is on the third item in the menu instead of the first. This is apparently not a new bug; it happens in prod too. This is a pretty significant regression. I think it should be fixed as part of this update. |
I have a suspicion that the behavior I described in my previous comment has something to do with the position of the mouse before I press the shortcut key. BTW, I observed this in Chrome. This is because the menu was opening and focusing on the 3rd item consistently. Then, to work around a GitHub issue, I moved my mouse. Then when I came back to APG, the menu was opening with the first item focused. I am wondering if placing the mouse in the position on the screen where the 3rd menu item will appear and then opening the menu triggers focus to be placed on the third item instead of the first? |
@howard-e |
@mcking65 |
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 tried to use the shortcut key option+0 for both the English keyboard and the non-English keyboard. The shortcut key worked as expected.
See issue in skipto.js repository:
[https://github.com/skipto-landmarks-headings/page-script-5/issues/11]
SkipTo Issue 13: Disable shortcuts when in a input or textarea
WAI Preview Link (Last built on Tue, 23 Apr 2024 18:47:22 GMT).