Giter VIP home page Giter VIP logo

Comments (4)

KTS915 avatar KTS915 commented on June 12, 2024 1

Looking at @viktorix's example again, that's not actually using the details tag properly. It's actually still being operated via JavaScript whereas the details element works by pure HTML. You can tell because the left arrow doesn't change (as it should) while the right arrow does change (when it shouldn't be there at all).

I have now worked out how to do it right; now I have to remember how to make a PR!

from classicpress-v2.

viktorix avatar viktorix commented on June 12, 2024

I did a quick test. I swapped <ul> with <div>, <li> with <details>, and <h3> with <summary>. See below.

14873dd1-20af-4419-9777-2fbbcffa9e66

The main problem is that it uses a template, so changes to this accordion affect all other too.

function do_accordion_sections( $screen, $context, $data_object ) {

EDIT: Further examination shows that do_accordion_sections is only used once for nav menus. So no issues elsewhere.

For reference:
https://nikitahl.com/native-html-accordion

from classicpress-v2.

KTS915 avatar KTS915 commented on June 12, 2024

This is a great idea. On my own sites, I make many custom menus and lists using the details and summary elements.

But, while I understand that this was just a quick trial, you can't implement the change like that. You need to keep the ul and li elements, and put the details and summary elements inside each li. Then you need to check what the relevant JavaScript is doing, and whether it should even be disabled somehow.

Or you could wrap all the details elements inside one overarching details element.

from classicpress-v2.

bahiirwa avatar bahiirwa commented on June 12, 2024

This would be a nice resource to check against for this: https://www.hassellinclusion.com/blog/accessible-accordions-part-2-using-details-summary/

from classicpress-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.