Skip to content

Commit

Permalink
feat(modal): trap focus in opened modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Mar 19, 2020
1 parent 06763e1 commit 0393967
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as
# Ember CLI so that your addon works for all apps
- "8"
- "10"

sudo: false
dist: trusty
Expand Down
4 changes: 2 additions & 2 deletions addon/templates/components/uk-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#-in-element containerElement}}
<div id={{this.modalId}} class={{@modalClass}} data-test-animating={{this.isAnimating}}>
<div class="uk-modal-dialog {{@dialogClass}}">
<div class="uk-modal-dialog {{@dialogClass}}" role="dialog" aria-modal="true" aria-labelledby={{concat this.modalId "-header"}} {{focus-trap isActive=this.visible focusTrapOptions=(hash initialFocus=(concat this.modalSelector " .uk-modal-dialog"))}}>
{{#if this.btnClose}}<button class="uk-modal-close-default" type="button" uk-close></button>{{/if}}
{{yield (hash
header = (component "uk-modal/header")
header = (component "uk-modal/header" id=(concat this.modalId "-header"))
body = (component "uk-modal/body")
footer = (component "uk-modal/footer")
)}}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"ember-concurrency": "1.1.5",
"ember-disable-prototype-extensions": "1.1.3",
"ember-export-application-global": "2.0.1",
"ember-focus-trap": "0.4.0",
"ember-load-initializers": "2.1.1",
"ember-maybe-import-regenerator": "0.1.6",
"ember-prism": "0.5.0",
Expand All @@ -91,7 +92,7 @@
"sass": "1.25.0"
},
"engines": {
"node": "8.* || >= 10.*"
"node": "10.* || >= 12.*"
},
"ember-addon": {
"configPath": "tests/dummy/config",
Expand Down
25 changes: 24 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5716,6 +5716,16 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ember-export-application-global/-/ember-export-application-global-2.0.1.tgz#b120a70e322ab208defc9e2daebe8d0dfc2dcd46"
integrity sha512-B7wiurPgsxsSGzJuPFkpBWnaeuCu2PGpG2BjyrfA1VcL7//o+5RSnZqiCEY326y7qmxb2GoCgo0ft03KBU0rRw==

[email protected]:
version "0.4.0"
resolved "https://registry.yarnpkg.com/ember-focus-trap/-/ember-focus-trap-0.4.0.tgz#b69a3a65a49784e2b3a19082655a585cfdaad473"
integrity sha512-NHKjTS1xoSS+fURDhAp5oyR7ZTTBnC4KVGw/VlUbFolx7jdLCePHuQdhnrhT02B1VP1dlX2RxnNvNiT2IcoA1w==
dependencies:
ember-auto-import "^1.5.3"
ember-cli-babel "^7.18.0"
ember-modifier-manager-polyfill "^1.2.0"
focus-trap "^5.1.0"

ember-gestures@^1.1.1:
version "1.1.5"
resolved "https://registry.yarnpkg.com/ember-gestures/-/ember-gestures-1.1.5.tgz#0d82f721c8606694f113f1cc7eb04e28d448989d"
Expand Down Expand Up @@ -6848,6 +6858,14 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

focus-trap@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-5.1.0.tgz#64a0bfabd95c382103397dbc96bfef3a3cf8e5ad"
integrity sha512-CkB/nrO55069QAUjWFBpX6oc+9V90Qhgpe6fBWApzruMq5gnlh90Oo7iSSDK7pKiV5ugG6OY2AXM5mxcmL3lwQ==
dependencies:
tabbable "^4.0.0"
xtend "^4.0.1"

follow-redirects@^1.0.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.9.0.tgz#8d5bcdc65b7108fe1508649c79c12d732dcedb4f"
Expand Down Expand Up @@ -12859,6 +12877,11 @@ sync-disk-cache@^1.3.3:
rimraf "^2.2.8"
username-sync "^1.0.2"

tabbable@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-4.0.0.tgz#5bff1d1135df1482cf0f0206434f15eadbeb9261"
integrity sha512-H1XoH1URcBOa/rZZWxLxHCtOdVUEev+9vo5YdYhC9tCY4wnybX+VQrCYuy9ubkg69fCBxCONJOSLGfw0DWMffQ==

table@^5.2.3:
version "5.4.6"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
Expand Down Expand Up @@ -13939,7 +13962,7 @@ xmlhttprequest-ssl@~1.5.4:
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e"
integrity sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=

xtend@^4.0.0, xtend@~4.0.1:
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
Expand Down

0 comments on commit 0393967

Please sign in to comment.