Skip to content

Add tool for obtaining <area> coords from image #40470

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

Merged
merged 15 commits into from
Jul 31, 2025

Conversation

Josh-Cena
Copy link
Member

Fix #37469. Technically this isn't an "example" because it doesn't use <area>, but I have no better place to put it.

@Josh-Cena Josh-Cena requested a review from a team as a code owner July 21, 2025 14:06
@Josh-Cena Josh-Cena requested review from estelle and removed request for a team July 21, 2025 14:06
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs size/m [PR only] 51-500 LoC changed labels Jul 21, 2025
Copy link
Contributor

github-actions bot commented Jul 21, 2025

@estelle
Copy link
Member

estelle commented Jul 22, 2025

I think this is best added to MDN as a tool, similar to the color picker and border generator.
I would house it as a "coordinates" tool, under the CSS shapes module, and link to it from basic shapes, and some shapes like https://developer.mozilla.org/en-US/docs/Web/CSS/basic-shape/polygon, and from anywhere where "coords" is a feature.
then we can link to it from the see also section on the <area> page.

@Josh-Cena
Copy link
Member Author

The reason I'm hesitant to do that is because my tool only supports the three shapes that coords accepts, so it would be kind of confusing to put in <basic-shape> as a general tool. Happy to do that and let you see how it looks.

@estelle
Copy link
Member

estelle commented Jul 22, 2025

The reason I'm hesitant to do that is because my tool only supports the three shapes that coords accepts, so it would be kind of confusing to put in <basic-shape> as a general tool. Happy to do that and let you see how it looks.

I didn't even notice the drop down. Could you add a "single point" as an <option> and output both "coords" and either

  1. circle()
  2. rect(), inset(), and xywh(), or
  3. `polygon()

if you want to be ambitious, you could also add

  1. cx, cy, and r for an SVG <circle>,
  2. x, y, width and height for SVG <rect>, and
  3. points for SVG <polygon>

that doesn't cover all the shapes, but makes your picker useful for coords attribute, six of the basic shapes, and, optionally, SVG shapes

@Josh-Cena Josh-Cena requested review from a team as code owners July 22, 2025 11:13
@Josh-Cena Josh-Cena requested review from pepelsbey and removed request for a team July 22, 2025 11:13
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Jul 22, 2025
@Josh-Cena Josh-Cena removed request for a team and pepelsbey July 22, 2025 11:13
Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i played with the layout a bit; adding headers to the output, and styling it as a DL

https://codepen.io/estelle/pen/empZMgj

Co-authored-by: Estelle Weyl <[email protected]>
@estelle
Copy link
Member

estelle commented Jul 27, 2025

This is looking really good. Not sure if you wanted a re-review yet.

There is an issue with the entire thing disappearing and then reappearing in my browser. Not sure if it's a Firefox thing, MDN play think, canvas thing, or PR dev env thing.

@Josh-Cena
Copy link
Member Author

I get that too, and not sure why that is. This is ready for re-review.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one suggestion. Looks good!

Co-authored-by: Estelle Weyl <[email protected]>
@Josh-Cena
Copy link
Member Author

Looks much better, thanks!

@Josh-Cena Josh-Cena merged commit efebdd8 into mdn:main Jul 31, 2025
8 checks passed
@Josh-Cena Josh-Cena deleted the area-coords-tool branch July 31, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mention how to obtain coordinates of image for area#coords
2 participants