Merge pull request #3949 from pngwn/3948-resize-a11y

Add `aria-hidden=true` to resize-listeners
pull/3950/head
Rich Harris 5 years ago committed by GitHub
commit a85c250bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,9 @@
# Svelte changelog # Svelte changelog
## Unreleased
* Add `aria-hidden="true"` to objects generated when adding resize-listeners, to improve accessibility ([#3948](https://github.com/sveltejs/svelte/issues/3948))
## 3.14.1 ## 3.14.1
* Deconflict block method names with other variables ([#3900](https://github.com/sveltejs/svelte/issues/3900)) * Deconflict block method names with other variables ([#3900](https://github.com/sveltejs/svelte/issues/3900))

@ -237,6 +237,7 @@ export function add_resize_listener(element, fn) {
const object = document.createElement('object'); const object = document.createElement('object');
object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;');
object.setAttribute('aria-hidden', 'true');
object.type = 'text/html'; object.type = 'text/html';
object.tabIndex = -1; object.tabIndex = -1;

@ -0,0 +1,8 @@
export default {
async test({ assert, target }) {
const object = target.querySelector('object');
assert.equal(object.getAttribute('aria-hidden'), "true");
assert.equal(object.getAttribute('tabindex'), "-1");
}
};

@ -0,0 +1,10 @@
<script>
let offsetWidth = 0;
let offsetHeight = 0;
</script>
<div bind:offsetHeight bind:offsetWidth>
<h1>Hello</h1>
</div>
Loading…
Cancel
Save