Comments (6)
Interesting, I missed your link and must've been hiding under a rock because I hadn't heard of the :target
selector. It's well supported, so I'm going to reopen this for evaluation.
from shoelace.
Haha. For the record, I only stumbled on the :target
selector myself when looking for an example to link to on this github issue. So plenty of "rock-hiding" going around these days!
from shoelace.
The only example I've seen of pure CSS tabs involved radio buttons, basically like this one:
https://codepen.io/wallaceerick/pen/ojtal
It's clever, but the markup required to achieve this is a bit complex and requires a certain order that's hard to remember. You also can't trigger the tabs via keyboard in most (all?) browsers since the input is hidden. Not sure if there's an easy way around that.
The JS for tabs is super light weight. The current example uses jQuery but I'm planning to rewrite it with a vanilla version so we can drop all third party dependencies. There will also be a small script for dropdowns too, which are landing in the next beta. These will eventually end up minified in /dist
so they can be loaded via CDN.
There's a fine line between "starter kit" and framework, and including scripts definitely starts to cross that line. However, I feel that certain components (e.g. tabs and dropdowns) are so incredibly common that leaving them out would be a disservice to the library and its users.
That said, I do wish we could somehow avoid scripts for these two components. It would be cool, but it's probably not feasible at this point in time given what we're trying to accomplish.
from shoelace.
Cool - makes sense. I've used the radio input method before, but hadn't realized the inability to trigger it with keyboard! Thanks for that.
Did you see the css-tricks example I linked in my first comment: https://css-tricks.com/css3-tabs/ It doesn't use radio inputs. Instead, it uses :target
which is well-supported and has markup that is really straight-forward.
from shoelace.
I just read more from that article and viewed some demos... and I didn't get the best feel for them and would just go with rolling my own js snippet or grabbing yours.
All the best!
from shoelace.
Hmm, some problems with :target
:
- Can't set active state on a tab
- Can't prevent window from scrolling without JS
- Can't prevent tabs from hijacking the back button without JS
Interesting approach though. Going to close this in favor of the original script.
from shoelace.
Related Issues (20)
- Dialogs do not allow focus in <iframe> and <video> elements HOT 7
- Cannot change internal role of sl-button HOT 3
- can't swipe to change slide on Android Firefox sl-carousel HOT 2
- Can not install using NPM HOT 1
- theme style.js files missing TypeScript definitions HOT 3
- Tabbing between multiple select instances does not close the select input HOT 3
- TypeScript with `module: node16` complains about naked imports
- No way to provide visually hidden label to sl-select HOT 3
- [Input] - Allow to change positioning of hint text
- refactor stopAnimations function
- Input prefix and suffix not displaying in react.
- SlButton Clicks Not Suppressed when in Loading State HOT 3
- Switch doesn't allow setting `aria-describedby` HOT 1
- Update "Form Controls" documentation to be more explicit
- Tooltip has some accessibility/screenreader issues around reading content HOT 1
- Empty radio-group leads to exception HOT 3
- <sl-select> with "muiltiple" only sends a single item to FormData, when more than one is selected. HOT 1
- Close Event force closing other element [ Dialog, dropdown, drawer] HOT 5
- `<sl-rating precision>` sometimes doesn't reset when leaving with the mouse
- `scrollbar-gutter: stable` conflicting with overlayed UI components (e.g. dialog, drawer) 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 shoelace.