正在加载视频...

视频加载失败

Future UI Tip ✨ You can create an HTML && CSS only Accordion that only has one section open at a time 🤙 Do this by adding a matching name attribute to sibling details elements ✨ One Two Check this video where the sibling elements have their name attributes...

362,458 次观看 • 2 年前 •via X (Twitter)

10 条评论

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Here's that @CodePen link! 🚀 You'll need to be in Chrome Canary to see this working as expected ⭐️ But, without it, you'll get the standard details && summary behavior.

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

As for the @openuicg work around this Accordion behavior, here's the explainer 👇 Been cool to have a poke around and catch up with some of this stuff this week 🤙

Matt 的头像
Matt2 年前

Man I’ve been living in my old havbits, wth is a details element? @chriscoyier I need my daily web blogs back 🥹

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Heh – It's a "disclosure" element, think "Collapsible section" that's HTML only. This new pattern provides an out-of-the-box solution for only having one open at a time which is something people often progressively enhance with JavaScript to achieve 🤙 We will get the blog site up and running 🙏

GrahamTheDev 的头像
GrahamTheDev2 年前

Super interesting after our chat, didn’t know this was a proposal, never mind shipping. One thing that is interesting after our conversation is whether we will need a wrapper with role=“group”, as that might get built in? I see no mention of that but I haven’t dug deep yet. 💗

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

The introduction of a name attribute would likely provide an implicit grouping. But Adrian's solution of providing the section is likely still a good practice as you'll likely want to provide a header or something like "FAQ" for example 🤔

Brandon McConnell 的头像
Brandon McConnell2 年前

I’ve been doing this for a while with pure HTML/CSS but using the old radio hack 😉

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Yeah, the only issue with the hacks is the accessibility implications of introducing things like a radio button etc. which could lead to confusion for a user if they aren't labelled correctly etc. I've seen some hacks with the content outside of the details element and that defeats the point of using the disclosure element in the first place 😅

Med 的头像
Med2 年前

Hi Jhey, I am a mid senior level front end dev, I work on Next js and improve my skills around front end. With image and videos conversion to a working app. Do you think front end roles will still be relevant? And what should I do stay relevant.

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

They will totally be relevant IMO 💯 These new tools are incredible and I think the opportunities they create are exciting. For me, this means more time and space for innovation. A lot of these tools in their current state are also primarily creating foundations to be built upon.

相关视频