Amphtml: Make checkbox-hack legal in amp html

Created on 21 Nov 2016  路  3Comments  路  Source: ampproject/amphtml

I wonder whether you would consider making the checkbox hack a legal construct in amp?

The checkbox-hack is a construct that enables pure css to style interactive elements such as drawers, popup menus, modals etc. Anything really that requires a toggle.

Currently i believe it is not possible to use this construct within amp because the checkbox is not legal to use. This is a shame as this technique is a powerful trick in the arsenal of devs trying to build progressive web apps. It serves the same kind of goals that amp strives for.

Would you consider allowing checkbox for this purpose?

DiscussioQuestion

Most helpful comment

Also, the checkbox input type is legal. It wasn't in the past, and there was a period where it was only legal inside a <form> element, but now you should be able to use it in any context, which should allow you to use the CSS trick you describe. You can try it out on https://validator.ampproject.org/

All 3 comments

I believe this falls into the same bucket as https://github.com/ampproject/amphtml/issues/1032.

Also, the checkbox input type is legal. It wasn't in the past, and there was a period where it was only legal inside a <form> element, but now you should be able to use it in any context, which should allow you to use the CSS trick you describe. You can try it out on https://validator.ampproject.org/

Also, the checkbox input type is legal.

Woot woot!! That's great news! I was under the impression that it was a restricted element. Thanks!

Was this page helpful?
0 / 5 - 0 ratings