Allow alternatives to H-tags for the heading of amp-accordion #21046
Comments
|
Triaging to @aghassemi , feel free to re-assign |
|
related #22381 |
|
@caroqliu , do you think there will be time to get to this sometime soon? I imagine it wouldn't be hard to implement... hopefully... perhaps? Or perhaps it would make a good first issue for aspiring contributors? |
|
Just pinging this up... |
|
Hey @morsssss, thanks for keeping track of this! Yes, we are expecting to get to this in the coming weeks. |
|
@SimonHogstromRonbol Would allowing just Implementation optionsIf we allow only a subset of non-heading tags to be headers (with the If we allow any non-heading tag to be a header, as long as it has the
* or maybe |
|
I personally would bias toward giving developers the benefit of the doubt. Certainly most people would discourage a developer from making a In other words, you can already build your own accordion in AMP using events, actions, and animations, using any elements you'd like, so I wouldn't restrict what the header tag should be. That's just my opinion, though. If you want to keep this safer, I personally prefer the wildcard validation rule approach over a check that occurs at runtime. |
|
@codyjrivera allowing If the reason for disallowing certain elements is not for the betterment of performance, and not for the betterment of user friendliness, but instead based on what we feel would suit the element best, we start restricting the creativity of developers, and I know this sounds a little lofty, but being a developer whose main focus is on building sites using AMP, and hearing from the people on my team that are also mainly focused on AMP, the frustration starts, when they feel like a rule doesn't serve a purpose other than making an AMP element fit a design or an opinion put forth by the developer behind it. So, while I agree that using a So if I were to choose, I'd suggest that adding a heading or data-header attribute to any element that is a direct child element in each section should be allowed. |
|
Taking a deeper look at this, this seems to be the only AMP component that uses the validator to enforce its child tags to be @morsssss Is there even a reason for us to check non- |
|
I don't think there's any reason to check those tags. I'd guess that the It might have been more logical to have people tag the header in some way, not to simply assume that the first child is the header, but that horse is already out of the barn. Um, that's not the expression. What's the expression? Anyway, I mean to say, If someone wants to use something strange for the header, that's their choice, and I don't think that could be used to create a layout that shifts before user action or otherwise harm our guarantees for performance and layout. Thanks for this discussion - and thanks for being flexible :) |
|
@SimonHogstromRonbol Though it's not clear why we restricted the header on the first place, on second look I would argue there is an accessibility case for keeping new allowances at least well-defined. We currently |
|
@caroqliu Good point that we have to take accessibility into account when we change the default behavior of certain elements, would it make sense to go from an allowlist approach to a blocklist approach, so instead of just allowing Alternatively, I feel like in a perfect world we'd be able to define any non- |
|
I agree with that. To avoid potentially disallowing valid use cases that we can't always predict, I think it would be best to block a few undesirable elements with a denylist. |
|
@ampproject/wg-caching Is there a way of enforcing a denylist on child tags using the validator syntax? There's |
Describe the new feature or change to an existing feature you'd like to see
I would like to use an amp-accordion to create a mobile menu with several layers of dropdown menu, and by using an amp-accordian, I get a fancy foldout animation and the look is just how I like it.
unfortunately, the clickable tab part of an amp-accordian is forced to be an h-tag, and the seo specialists I work with are not so keen on using H-tag outside og articles, and especially not around the menu.
So I would very much like it if we could define a heading attribute on the heading as an alternative to being forced to use an h-tag, so you could use any element you'd like.
Describe alternatives you've considered
I've considered 2 alternatives:
Additional context
an example of what a basic amp-accordian looks like today: (taken from ampbyexample)
here is an example of what I suggest we could do for the future:
The text was updated successfully, but these errors were encountered: