diff --git a/.travis.yml b/.travis.yml index 555440c..3b2fe5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,5 @@ language: node_js -sudo: required -before_script: -- npm install -g bower polymer-cli -- polymer install node_js: '6' -addons: - firefox: latest - apt: - sources: - - google-chrome - packages: - - google-chrome-stable -script: -- xvfb-run polymer test -- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test -s 'windows 10/microsoftedge@14' -s 'os x 10.11/safari@9' -s 'macos 10.12/safari@10'; fi -dist: trusty env: global: - secure: VpPRx1TJb2Kw3+Em4ViH3H2CRHwM+mzliygcWc+kH0k9+iYnKfTOfI+ZsrzE5joCy7qZPAQgNKduvZ9/oDAZrGx/byhFcu5a+/I4sJPQP7kHXVtGK5+WN3Db8uKGkTc5J2539qAhYLmER+gRhazz2c7QQL6zS4cfkYArprEXANJk6neW+kyRN0TYl0YZVp2vW6ZqRxgCv7UDma2u/DIq37Z2T+CzAOYOoZccIWMN4qeEucZZDLf15c+MuTC2sq+BR9t4360Lj4Cp6WPOm5MWpo2pYFHTWOCEviVlzumQh4V9Xb5OXpASoZ7mTHiqXhgkmIWhk527A3GOo2VYPmOH7s/C3VbMabgJhmQVOIIg/IwRnIeTOLbPyOaQFmz2fA9s799noUV7PSCelBISacn0OtYfE6HcWWzICRv7ji6P/lTPOMBarxfqBQx3tgDoGEe019qxEoA3XT6T36MBntg7SKLNu/3Ankt0euC8x65v/zOLpnDfjbzBcgz8p4XCThpwNJNobo0ZMwljHqBqrsd2CDAWixCuVbKoUwuzn8PusG8HYZKCDOUsiRi42Ub0mcubJpqZTx3mcmgb/iAJAf/6s4iropqzpzeAM4sX/CwS/HaqdRa/KW/6jCBVLJApvGOJ862GXpUh7AKgIi0VW1zfMolBSyFEJNV4wFhGfFqsZ3M= diff --git a/README.md b/README.md index 50831fc..e6d5b04 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -[![Build Status](https://travis-ci.org/PolymerLabs/blockingElements.svg?branch=master)](https://travis-ci.org/PolymerLabs/blockingElements) +[![Build Status](https://travis-ci.org/PolymerLabs/blocking-elements.svg?branch=master)](https://travis-ci.org/PolymerLabs/blocking-elements) -# `blockingElements` stack API +# Blocking Elements stack API -Implementation of proposal +Implementation of proposal https://github.com/whatwg/html/issues/897 + +> The polyfill chooses a non-colliding name (`document.$blockingElements` instead of `document.blockingElements`) as the proposal is still work in progress and hasn't yet reached consensus on the semantics and functionality (see [this discussion](https://github.com/PolymerLabs/blocking-elements/pull/1#issuecomment-235102344) for more details). `document.$blockingElements` manages a stack of elements that inert the interaction outside them. @@ -15,7 +17,7 @@ This polyfill will: - search for the path of the element to block up to `document.body` - set `inert` to all the siblings of each parent, skipping the parents and the element's distributed content (if any) -Use this polyfill together with the [WICG/inert](https://github.com/WICG/inert) polyfill to disable interactions on the rest of the document. See the [demo page](https://github.com/PolymerLabs/blockingElements/blob/master/demo/index.html) as an example. +Use this polyfill together with the [wicg-inert](https://github.com/WICG/inert) polyfill to disable interactions on the rest of the document. See the [demo page](https://github.com/PolymerLabs/blocking-elements/blob/master/demo/index.html) as an example. ## Why not listening to events that trigger focus change? @@ -25,21 +27,51 @@ Wrapping the focus requires to find all the focusable nodes within the top block This approach doesn't allow the focus to move outside the window (e.g. to the browser's url bar, dev console if opened, etc.), and is less robust when used with assistive technology (e.g. android talkback allows to move focus with swipe on screen, Apple Voiceover allows to move focus with special keyboard combinations). -## Install & run locally +## Install & use -Install the dependencies with `bower install`. +Blocking Elements relies on the [`inert` attribute](https://github.com/WICG/inert) and uses [`Set` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set), so make sure to include their polyfills as needed. -Serve the resources via the [polymer CLI](https://github.com/Polymer/polymer-cli): ```bash -$ npm install -g polymer-cli -$ polymer serve +npm install --save babel-polyfill +npm install --save wicg-inert +npm install --save blocking-elements +``` + +```html + + + + +
+ + +
+ + + + ``` +## Local development + +Install the dependencies with `npm install` and serve the resources. + +Run the tests locally by navigating to http://localhost:8080/test/ + ## Performance Performance is dependent on the `inert` polyfill performance. Chrome recently landed [the `inert` attribute implementation](https://codereview.chromium.org/2088453002/) behind a flag. -Let's compare the how long it takes to toggle the deepest `x-trap-focus` inside nested `x-b` of the demo page () ![results](https://cloud.githubusercontent.com/assets/6173664/17538133/914f365a-5e57-11e6-9b91-1c6b7eb22d57.png). +Let's compare the how long it takes to toggle the deepest `x-trap-focus` inside nested `x-b` of the demo page () + +![results](https://cloud.githubusercontent.com/assets/6173664/17538133/914f365a-5e57-11e6-9b91-1c6b7eb22d57.png). `blockingElements` with native inert is **~15x faster** than polyfilled inert 🎉 🎉 🎉 diff --git a/bower.json b/bower.json deleted file mode 100644 index ce8a234..0000000 --- a/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "blocking-elements", - "description": "A polyfill for the proposed blocking elments stack API", - "main": "blocking-elements.html", - "authors": [ - "Valdrin Koshi " - ], - "license": "Apache-2.0", - "keywords": [ - "blocking", - "elements", - "polyfill", - "browser" - ], - "homepage": "https://github.com/PolymerLabs/blockingElements", - "private": true, - "devDependencies": { - "inert": "WICG/inert#^1", - "web-component-tester": "Polymer/web-component-tester#^6", - "webcomponentsjs": "webcomponents/webcomponentsjs#^1" - }, - "ignore": [] -} diff --git a/demo/ce.html b/demo/ce.html index a43ba49..e7bc024 100644 --- a/demo/ce.html +++ b/demo/ce.html @@ -16,9 +16,10 @@ blockingElements polyfill test page - - - + + + + + +