Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-7794 Accordion #541

Merged
merged 33 commits into from
Feb 13, 2023
Merged

UHF-7794 Accordion #541

merged 33 commits into from
Feb 13, 2023

Conversation

rpnykanen
Copy link
Contributor

@rpnykanen rpnykanen commented Feb 7, 2023

UHF-7794

Created javascript library to replace the handorgel-accordion library

What was done

  • Basic accordion functionality
    • open, close, toggle
  • Handle anchor tags
    • If url has anchor tag, correct accordion item is set as open
    • Handle scrolling into the anchor item automatically
  • Handle focus change on element close
    • set focus on an element which is visible since close element will be hidden.
  • Handle unique id creation
    • If multiple accordion items across multiple accordions have same id
      • add suffix to the element.

How to install

  • Make sure your instance is up and running on latest dev branch.
    • git pull origin dev
    • make fresh
  • Update the HDBT theme
    • composer require drupal/hdbt:dev-UHF-7794_accordion
    • composer require drupal/helfi_platform_config:dev-UHF-7794_accordion
  • Run make drush-cr

How to test

  • Go to a page with with accordion. preferably multiple accordions.
  • Open, close and toggle should work as intended
    • Element's aria-expanded should change accordingly
  • Refresh the page with anchor tag
    • Correct accordion item should be opened automatically
    • Automatic scroll after page has loaded
  • Unique id creation
    • Add an accordion with 2-3 items with same heading
    • The items should have unique id: for example "heading", "heading_1", "heading_2"
    • You can try this with 2 separate accordions on same page, it should update all duplicates

Other PRs

City-of-Helsinki/drupal-helfi-platform-config#432

@teroelonen teroelonen changed the title UHF-7794 accordion UHF-7794 Accordion Feb 8, 2023
Copy link
Contributor

@teroelonen teroelonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was really nice 🦖 Also was super nice to work with you on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants