summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2018-03-09 21:18:59 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-03-09 21:18:59 +0000
commitd0953bccb1b26eb24cf7c6137bd3e144c453e271 (patch)
treef3a6cfec67f3ac45809c4655f83fc9fe2f1a1e31
parent930d12b4115454f527bbc0259d814d9e66dc7a2a (diff)
downloadgitlab-ce-docs-fe-html.tar.gz
Add role="button"docs-fe-html
-rw-r--r--doc/development/new_fe_guide/style/html.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/development/new_fe_guide/style/html.md b/doc/development/new_fe_guide/style/html.md
index 2eea91ca0fc..2d5b7d048ab 100644
--- a/doc/development/new_fe_guide/style/html.md
+++ b/doc/development/new_fe_guide/style/html.md
@@ -13,6 +13,17 @@
<button type="button"></button>
```
+<a name="button-role"></a><a name="1.2"></a>
+- [1.2](#button-role) **Use button role for non buttons** If an HTML element has an onClick handler but is not a button, it should have `role="button"`. This is more [accessible][button-role-accessible].
+
+```
+// bad
+<div onClick="doSomething"></div>
+
+// good
+<div role="button" onClick="doSomething"></div>
+```
+
## Links
<a name="blank-links"></a><a name="2.1"></a>
@@ -38,4 +49,5 @@
```
[button-type-spec]: https://www.w3.org/TR/2011/WD-html5-20110525/the-button-element.html#dom-button-type
+[button-role-accessible]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role
[jitbit-target-blank]: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/