Skip to content

Commit

Permalink
Make showPicker() consume user activation
Browse files Browse the repository at this point in the history
Allowing the page to call showPicker() as much as it wants without
consuming user activation may result in the user being unable to
interact with the browser UI due to popups always taking focus.

Spec issue: whatwg/html#10084

Bug: 1521345
Change-Id: If6308a67bac9050f695d18d275ea86c23ac22b0d
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Jan 24, 2024
1 parent 785113a commit c5bb306
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@
input.blur();
}, `input[type=${inputType}] showPicker() does not throw when user activation is active`);
}

for (const inputType of inputTypes) {
promise_test(async () => {
const input = document.createElement('input');
input.setAttribute('type', inputType);

await test_driver.bless('show picker');
input.showPicker();
assert_throws_dom('NotAllowedError', () => input.showPicker());
}, `input[type=${inputType}] showPicker() consumes user activation.`);
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
await test_driver.bless('show picker');
select.showPicker();
select.blur();

assert_throws_dom('NotAllowedError', () => select.showPicker(),
'User activation should be consumed after calling showPicker().');
}, `select showPicker() does not throw when user activation is active`);
</script>
</script>

0 comments on commit c5bb306

Please sign in to comment.