Comments (4)
@DiemenDesign - I was reading more about role="button"
here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role and it says:
The button role should be used for clickable elements that trigger a response when activated by the user.
A button is a widget used to perform actions such as submitting a form, opening a dialog, cancelling an action, or performing a command such as inserting a new record or displaying information.
While a link could be considered "a response", it sounds like it's more for tags that simulate a button action rather than tags that look like buttons.
So, even though role="button"
is an interesting option I'm inclined to leave the button styling as <a><b>
and <a><i>
since they appear to be more semantically correct. I could see this going either way though and happy to revisit it though if there's a popular consensus to the opposite.
Thanks again for proposing this as I didn't even know about these attributes before.
from mvp.
Just been doing some more research into using custom role values, they have set values, this means if we use our own custom values the document they are in will no longer be valid. However, we could use data-
attributes for the same purpose as they can be styled. And where we are changing the behaviour of elements such as <a/>
to behave as though it's a <button/>
we can use role="button"
to style it how we want.
from mvp.
Thanks @DiemenDesign, this is a neat feature that I wasn't aware of.
I like the idea of role="button"
. If we're moving away from <a><b>
it would be nice to ditch <a><i>
as well, but I'm not sure how to do that without introducing a custom attribute like data-
, which I'm not in favor of since the goal is to have the styling affect only standard HTML tags and attributes. If we have to use <a role="button"><i>
anyway, then it's just more typing for not that much better markup (since most MVPs won't need the accessibility benefits of role=
).
But, if there's a slick way to create an outline button with one standard HTML tag then it could be a compelling solution. Any ideas around that?
from mvp.
It is a tricky one, the role="button"
on anchors when changing it's behaviour to a button representation makes sense to me for accessibility in particular. And similar could be used for other elements when used with different behaviours as well. For keeping an outline button as per the example page, we could seperatly style the .a[role="button"]{}
like what is already happening with button{}
style directive to adjust it's background colour.
The data-
attribute is a different beast. For e.g. in my CMS I'm using something like <section data-content="category"/>
where I want to restyle how the <aside/>
elements look, but don't want to affect how the original (to mvp.css at least) <aside/>
look on the page. Maybe it's something that people can be made aware that can be done to achieve differences to the look of elements like colour for e.g., without altering too much of the original mvp.css stylesheet.
from mvp.
Related Issues (20)
- Implement semantic role attribute HOT 1
- In Sections, justify-content: center clips content on small screens HOT 7
- Question on <a> usage HOT 2
- Strange alignment of checkbox and radio inputs HOT 2
- hr tag inside section tag is not visible (version 1.7.1) HOT 11
- How to create a full-bleed for a section? HOT 6
- Headings & Forms don't create a newline after them HOT 5
- How about fieldset for inline / flex groups? HOT 1
- Non-semantic labels require IDs & yield minimum target size HOT 1
- Why is the dark mode commented-out? HOT 1
- light/dark mode not working on website HOT 4
- Full width header/footer HOT 2
- Misbehaviour with a standard example page HOT 1
- Why is dark/light mode not part of the package? HOT 6
- How to make input width same as the card container HOT 4
- Unused empty space ? HOT 1
- Style <input type="submit"> as a button HOT 4
- bug in the website when opening the website in safari like the close button is floating on the screen. HOT 2
- Solarized MVP HOT 1
- Underline links HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvp.