Merge pull request #10187 from ahocevar/tabindex-scrollover

Set touch-action to allow native touch gestures
This commit is contained in:
Andreas Hocevar
2019-10-28 13:49:44 +01:00
committed by GitHub
4 changed files with 50 additions and 4 deletions

View File

@@ -662,6 +662,21 @@ describe('ol.Map', function() {
expect(map.handleResize_).to.be.ok();
});
it('handles touch-action on focus and blur', function() {
expect(map.focusHandlerKeys_).to.be(null);
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
const target = document.createElement('div');
target.setAttribute('tabindex', 1);
map.setTarget(target);
expect(Array.isArray(map.focusHandlerKeys_)).to.be(true);
expect(map.getViewport().getAttribute('touch-action')).to.be('auto');
target.dispatchEvent(new Event('focus'));
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
map.setTarget(null);
expect(map.focusHandlerKeys_).to.be(null);
expect(map.getViewport().getAttribute('touch-action')).to.be('none');
});
describe('call setTarget with null', function() {
it('unregisters the viewport resize listener', function() {
map.setTarget(null);