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

Add <area> example #920

Merged
merged 6 commits into from
May 18, 2018
Merged

Add <area> example #920

merged 6 commits into from
May 18, 2018

Conversation

2alin
Copy link
Contributor

@2alin 2alin commented May 13, 2018

Fixes #758
This one, was full of fun 😁.
Because of the length taken by the coordinates of a polygon area, I decided to not put an alt property in the anchors (but I did in the image). If I need to specify that anyway, I could write alt="go to ..." and it will take at least 16 more characters of horizontal space, please let me know.

The whole graphic, was made from scratch by me in inkscape (I only took the dinosaur head from an external source), so there won't be any kind of copyright problem 😉.

@wbamberg
Copy link
Contributor

This is really cool! Nice job :)

I think you do need alt, because it's mandated. I checked using the W3C validator, and it gave me the expected error:

screen shot 2018-05-16 at 9 05 12 pm

I take your point about horizontal space though. What I do is use hard line breaks to make sure that the markup will be readable when the browser window is 1000px (preferably less, more like 900px). I've done this a lot with the input examples, which typically use lots of attributes (e.g. https://interactive-examples.mdn.mozilla.net/pages/tabbed/input-password.html).

Then you get the other problem of course, which is lots of lines in the example. In this case I would probably suggest having fewer hotspots in the image. For example you could have just three - HTML, CSS, JS. Or maybe four, and you could put MDN in the middle, then you could demo circle as well as poly. I'm sorry to put you to the trouble of reworking the image though :(.

What do you think about having the links go somewhere, using something like:

<area shape="poly" coords="207,241,54,241,72,217,189,217"
      href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">

@2alin
Copy link
Contributor Author

2alin commented May 17, 2018

@wbamberg I agree about the links going to real articles in MDN, that's what I thought in the beginning but the lines were too long and I went for dummy links instead. Now that you suggest about using hard coded break lines, I'll apply then all what you said.

And about changing the figure for one with less area objects, well it's a pity 'cause I kinda liked it. But user experience is first, and if we need to make it again, we just make it, no problem 😅. I'll probably work on it in two days, I'll be kinda busy tomorrow (it's already night at my place).

I'm thinking about using this kind of figure instead (see drawing attached please). If you find it suitable to use, I have two questions:

  1. JS or JavaScript in the label's text?
  2. is it alright (for demo purposes) if the polygon shape to use doesn't fit most of the area that corresponds in the figure? I would use an irregular polygon, maybe 5 points, covering the text area (css/html/js) and a little more, but it will cover at most 60-70% of each figure's region.

p_20180516_234920

@2alin
Copy link
Contributor Author

2alin commented May 17, 2018

And because the example is for <area>, I'm trying to cover all three different shapes: circle, poly, and rect. But if it's too much, I can make the figure without the rectangle at the corner. What do you think is best?

@wbamberg
Copy link
Contributor

Actually, thinking some more about this, I think you can keep the image and the example won't be too long. Let's say you split each area element across three lines, like:

    <area shape="circle" coords="130,136,60"
          href="https://developer.mozilla.org/docs/Web/JavaScript"
          target="_blank" alt="some alt text" />

...then I think the example would be about 25 lines long, which is fine.

One thing I missed before: even when you don't need it we are preferring to use /> to close th element, so:

<area some stuff />

not:

<area some stuff >

@2alin
Copy link
Contributor Author

2alin commented May 18, 2018

Done!
Could you review it again? please. Code ended up quite dense, mainly because of coords and href values, but as you said, it's only 24 lines 😁.

@2alin 2alin mentioned this pull request May 18, 2018
@2alin 2alin closed this May 18, 2018
@2alin 2alin deleted the add-area-example branch May 18, 2018 19:01
@2alin 2alin restored the add-area-example branch May 18, 2018 19:09
@2alin 2alin reopened this May 18, 2018
@wbamberg
Copy link
Contributor

eek! I wondered what had happened to it! :-)

@2alin
Copy link
Contributor Author

2alin commented May 18, 2018

sorry!! I was trying to push delete another branch from terminal, and I mistakenly deleted this one 😅, but I think all is back to normal now.

Copy link
Contributor

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

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

This is a really nice example. Thanks for taking the time on it :).

@wbamberg wbamberg merged commit 3b53b4f into mdn:master May 18, 2018
@2alin 2alin deleted the add-area-example branch May 18, 2018 23:15
@2alin
Copy link
Contributor Author

2alin commented May 18, 2018

thank to you for reviewing it and all the corrections you pointed out :)

wbamberg pushed a commit to wbamberg/interactive-examples that referenced this pull request May 25, 2018
* upstream/master: (39 commits)
  Add video example. (mdn#939)
  Add track example. (mdn#940)
  Change `html` to `tabbed` in Publishing section (mdn#942)
  adding font-optical-sizing example (mdn#919)
  chore(deps): update dependency jest to v22.4.4 (mdn#935)
  fix(tabbed-editor): issue mdn#860, isolate CSS to output (mdn#927)
  Add img example. (mdn#923)
  Add <area> example (mdn#920)
  Add <map> example (mdn#931)
  Add HTML example for <audio> (mdn#930)
  chore(community): add @Regaddi as contributor (mdn#933)
  chore(community): add @stephanmax as contributor (mdn#932)
  Add HTML example for <summary> (mdn#926)
  Add HTML example for <details> (mdn#924)
  Fix example: issue mdn#925, add (max-)width to container and left-align text to see full effect (mdn#929)
  Add String trim examples (mdn#922)
  chore(deps): update dependency stylelint to v9.2.1 (mdn#928)
  Add example for week input (mdn#902)
  Add url input example (mdn#901)
  Add html input search (mdn#897)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants