Comments (7)
+1 checkbox, radio had the same problem
from matter.
@nevf @DevFelixDorn I see, I'll look into it.
from matter.
@finnhvman Thanks. text should be optional for all of these.
from matter.
I've got a switch without any text inside an <a>
element and see a weird focus? outline when the <a>
has focus. I assume this is related to my original issue.
from matter.
@nevf @DevFelixDorn The Matter Switch, Radio, and Checkbox components rely on the same html structure, the root cause is basically the same for all these.
As far as I understood it's related to the vertical-align
property having the baseline
the default value (CSS Spec). The outer-most wrapping element of these controls is the . In case there's text in the label, the baselines of the label and sibling controls are aligned well, if there's no text in the label it gets messed up.
One solution I can suggest is using a Zero-Width Space as text like <span>​</span>
.
The other solution could be me adding vertical-align: middle;
to the of these controls, but that would mess up the nice baseline alignment in case of texts.
What are your use cases for these controls without text?
@nevf The weird focus issue is probably the browser figuring out a combined outline of all the children elements of the anchor. In case of the Switch it's the pseudo element used for the ripple that causes the irregularity. You know, the growing and fading blue circle when you switch the switch. I can't really get around this issue, because of the CSS-onliness.
Although, I have to ask, why are you putting a Switch inside of an anchor?
According to HTML Specification it's not permitted (and it's not good UX):
Permitted content | Transparent, containing either flow content (excluding interactive content) or phrasing content.
from matter.
I need only a switch without span when I had a more complex layout which require some complex flexbox/grid. It's happened not really often but it's happened ¯_(ツ)_/¯
I don't put input in anchor elements
from matter.
@finnhvman Ben I'm using switch and checkbox in menu and tree items where the text is not part of the switch/checkbox. Further there are areas where I just use an icon
+ switch/checkbox with no text.
This screen shot shows examples of both:
A menu item/row is an <a>
with text, links, switch/checkbox inside it. I'll look at revisiting using an anchor for this type of menu item.
Would having two variations of switch/checkbox etc. be the solution, one with the text <span>
and one without?
Would the latter resolve my focus issue?
from matter.
Related Issues (20)
- Element Select and scale element as bootstrap .input-lg, .input-sm, .col-lg- *, and .col-sm- * HOT 4
- Question : Change size input
- Checkbox and Radio button styling
- Publishing on npm HOT 1
- Problem with version of browser
- Slider present in codepen but not in bundle file HOT 3
- Is this project alive? HOT 4
- can you give me tabs component? HOT 1
- Add a full demo page
- Can you add card ? HOT 2
- Add cards component HOT 4
- Matter 2
- Not an issue, but there are official Google pages using Matter HOT 2
- a mistake
- matter-progress-circular doesnt seem to work with values HOT 1
- Link to demo? HOT 3
- Sizing guidelines HOT 1
- Changing colors HOT 3
- Request for add new component 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 matter.