Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<layer->.focus() is misnamed, should be split up and renamed #587

Closed
prushforth opened this issue Nov 22, 2021 · 2 comments · Fixed by #797 or Maps4HTML/web-map-doc#115
Closed

<layer->.focus() is misnamed, should be split up and renamed #587

prushforth opened this issue Nov 22, 2021 · 2 comments · Fixed by #797 or Maps4HTML/web-map-doc#115
Labels
accessibility API Map and associated elements' non-declarative API (events and methods) needs discussion web platform compatibility

Comments

@prushforth
Copy link
Member

There is a standard HTMLElement.focus() method, which doesn't do what this method does, which is to zoom to the whole layer at the maximum possible zoom. We will need, at a minimum, to rename this method.

Since programmatic focus has become important, the HTMLLayerElement.focus() implementation should either focus the layer in the layer control, or focus the first or next element in the layer, without moving the map. We should figure out what the correct behaviour is, but I'm pretty sure the correct behaviour is not what it currently does. We probably need a separate method for each type of focus, actually.

@Malvoz
Copy link
Member

Malvoz commented Dec 21, 2021

the HTMLLayerElement.focus() implementation should either focus the layer in the layer control, or focus the first or next element in the layer, without moving the map. We should figure out what the correct behaviour is

In any case, I think it should not be the layer control since a "layer" refers to the container (of features etc.) on the map itself, separate from the layer control?

Another option to consider is to enable programmatic focus (tabindex="-1") on the <div class="mapml-layer ..."> (this would make even more sense if each of those layer elements also had an accessible name: #579). One use case for that can be found in https://maps4html.org/experiments/screenreader/closest-restaurants/: after the "Restaurants" button has been pressed AT/keyboard users could/should be directed (have focus delegated) to the relevant features?

@prushforth
Copy link
Member Author

We are leaning towards renaming the behaviour of the current layer-.focus() method to layer-.zoomTo().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility API Map and associated elements' non-declarative API (events and methods) needs discussion web platform compatibility
Projects
None yet
2 participants