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

added accelerator keys #265

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Expand Up @@ -5,19 +5,18 @@ services:
- docker

before_install:
- docker-compose up -d --build
- npm install eslint@v6.1.0 stylelint stylelint-config-wikimedia
- docker-compose up -d --build
- npm install eslint@v6.1.0 stylelint stylelint-config-wikimedia

before_script:
- docker-compose exec postgres psql wikilabels -U wikilabels -f /wikilabels/wikilabels/database/schema.sql
- docker-compose exec postgres psql wikilabels -U wikilabels -f /wikilabels/wikilabels/database/schema-testdata.sql
- docker-compose exec postgres psql wikilabels -U wikilabels -f /wikilabels/wikilabels/database/schema.sql
- docker-compose exec postgres psql wikilabels -U wikilabels -f /wikilabels/wikilabels/database/schema-testdata.sql

script:
- docker-compose exec wikilabels flake8 /wikilabels --ignore=E722,W504
# - timeout --preserve-status 8s wikilabels dev_server
- node --version
- ./node_modules/.bin/eslint "wikilabels/wsgi/static/js/**/*.js"
- ./node_modules/.bin/stylelint "wikilabels/wsgi/static/css/*.css"
- docker-compose exec wikilabels py.test --cov=wikilabels -m "not nottravis"

after_success:
Expand Down
18 changes: 18 additions & 0 deletions wikilabels/wsgi/static/js/oo.util.js
Expand Up @@ -84,6 +84,24 @@
}
};

function acceleratorKeys( e ) {

// Alt+Q
if ( e.altKey && e.keyCode === 81 ) {
document.getElementById( OO.ui.TextInputWidget ).select();
}
// Alt+A
if ( e.altKey && e.keyCode === 65 ) {
document.getElementById( OO.ui.RadioOptionWidget ).select();
}
// Alt+S
if ( e.altKey && e.keyCode === 83 ) {
document.getElementById( OO.ui.RadioInputWidget ).select();
}
}
// register the handler
document.addEventListener( 'keyup', acceleratorKeys, false );

OO.ui.getWidgetValue = function ( widget ) {
switch ( widget.constructor ) {
case OO.ui.ActionWidget:
Expand Down