-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unresponsive image maps #389
Comments
Almost one year has passed since the mentioned thread has been opened, I guess implementors have shown no interest in such issue. This is strange, as shape manipulation is already done in scaling vector images. |
SVG is not necessarily unresponsive, see analysis in https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Mar/0141.html But yeah, nobody has shown interest in implementing this yet, AFAIK. That could change of course. Maybe file bugs on the browsers asking for this, email the various cc @yoavweiss |
I guess that's a bit too much for me, as my project using image maps is still in development and I have nothing to show this issue on. |
As someone involved in the referenced discussions (in support of markup for responsive image maps), I think that the inline SVG solution works fine now that most browsers support it and will be even better once SVG 2.0 is finalized and supported (reducing the verbosity currently caused by having to use the xlink namespace a lot). So native HTML image maps seem largely redundant to me. Nevertheless, I see a need for action: I’d like to suggest to point to SVG as a modern and richer alternative in the part of the HTML spec that covers native HTML image maps (if there’s indeed no interest in modernizing them). Or else people will continue to dive deep into native HTML image maps and get frustrated when they find out that they have not been adapted to the requirements of today’s web … and this discussion will pop up rightly again and again. |
I don't see anywhere in the spec that image maps as they are today are flagged as "outdated" or "deprecated". In fact, I just see that it's a feature which has not received enough attention. The fact that there are dozens of resizing script solutions in the wild underlines a need, from authors, to use them. |
Just to clarify, I wouldn’t mind native HTML image maps being updated to be responsive. And AndySky21 lists arguments which are worth considering. Modernized native HTML image maps could be a better/more efficient solution for real use cases. My point is that it would be advisable to guide people to the SVG alternative iff the reality is that there’s no interest by implementors for a modernized native HTML solution. @AndySky21: SVG 2.0 isn’t a recommendation yet, but it’s clear that it will be. |
In order to test vendors' interest there should be at least an idea of how "responsive maps" should work, I guess. It'd be also necessary to introduce a new attribute on image maps, not to break legacy compatibility (there would be issues for the maps resized via script, e.g.). This attribute should point out initial dimensions for the map (e.g. sizes="xx yy"), so that only maps with that attribute are resized by UAs, and resizing scales them according to horizontal/vertical stretch from initial dimensions. (unfortunately I think there should be a solution for non-proportional scaling of circles). |
You can use img/picture in SVG using foreignObject, as was pointed out in the email cited above.
The email also lists real-world examples where this feature would be helpful, fwiw. |
ForeignObject is going to require an added level of complexity about syntax, instead of simplifying things, I guess. |
I think not. But that is not a particular common need, is it? I agree there are different pros and cons for the different approaches, and they all suck today. The question is should we make all of them slightly better, or focus on making only one better? I don't know, and personally I don't mind improving image maps, but there is little point in working on it in the spec if nobody wants to implement. |
I understand now. Can anyone please tell me how to notify vendor dev forums about this thread or this particular need, so that they can tell what approach they're going to support? |
You may start a thread on https://discourse.wicg.io to get a better feel of the community's need for this particular feature. Demonstrating usage of current JS libraries that accomplish that can also be helpful to convince people that this is not a niche issue. |
Here's a plan:
|
|
@zcorpan has there been any development for points 3 and 4? |
Nope. I'd like to wait for interoperable parsing of |
The funny part is that, from a quick test, 4 modern browsers (Edge, Chrome, FF, Opera) apply CSS transform on image maps. So there has been an effort to modernize this feature. |
Transforms working on image maps is not an intentional modernization of the feature. It's just that transforms work on all elements, and when you click on a transformed element it reports the click in "untransformed" coordinates, so image maps continue to work as expected. |
I don't know exactly, but the map areas are not technically descendants of the scaled image itself. |
@AndySky21 I have posted about progressive web maps, I would be curious to hear your comments. The areas in that map are responsive because the author has declared the size of the image via markup. Of course in the custom element I can't make the browser-managed areas responsive if the custom element isn't running. |
I'm confused by some of the conclusions here.
I think this would be great, but I can't replicate it, and the HTML spec says that's by design:
It would be great to have image maps being responsive, but the spec says that they should not be, for historical reasons:
I don't understand why this should prevent transforms embedded in media queries from working on the HTMLAreaElement.coords ? Those transformed coordinates could then be interpreted relative to the displayed image after stretching caused by width and height, which might work because the media condition that selected the image to display could be mirrored in a style that got processed before the image gets resized for the width and height. Pardon my lack of insight into the processing sequence here. I would like to help this get addressed. |
@prushforth the spec codified what browsers did, under the assumption that there is web content that relies on that behavior. So changing it carries the risk of breaking web content, which would need to be researched somehow. |
So looking at the bugs referenced in #514 (comment) the new coords parsing is implemented in Chromium and WebKit, but not yet in Gecko. |
https://html.spec.whatwg.org/multipage/embedded-content.html#processing-model
The text specifies that CSS cannot alter relative position of area elements. However, it does not detail how image maps can be built in a responsive way, i.e. how they can be associated to the new picture element, or simply how they can follow CSS resizing of relevant images.
This is a point that renders a very useful and widely supported feature completely useless in modern-day web applications.
Web developers have often resorted to resizing scripts in order to do that, there are quite a bunch of them in the wild. Why there is no native map resizing feature, or as an alternative how can this be obtained natively?
The text was updated successfully, but these errors were encountered: