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

TMS-1050: Accordion script fixes #178

Merged
merged 2 commits into from
Jun 11, 2024
Merged

TMS-1050: Accordion script fixes #178

merged 2 commits into from
Jun 11, 2024

Conversation

eebbi
Copy link
Contributor

@eebbi eebbi commented Jun 10, 2024

Severa-ID: 2247
Severa-kuvaus: TMS-1050 Tredun Koulutukset-sivun hakuvalintahaitari ei aukea
Task: https://hiondigital.atlassian.net/browse/TMS-1050

Description

Add if-statements and checks to prevent breaking other accordion-elements.

Motivation and Context

The new accordion script broke the functionality of an accordion-element in Tredu's program-search page template.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@eebbi eebbi requested a review from a team June 10, 2024 07:50
@HPiirainen HPiirainen self-assigned this Jun 10, 2024
Copy link
Contributor

@HPiirainen HPiirainen left a comment

Choose a reason for hiding this comment

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

Tsekkaa pienet huomiot

if ( ! dropdowns[ i ].classList.contains( 'active-accordion' ) ) {
dropdowns[ i ].classList.add( 'active-accordion' );
}
if ( dropdowns.length >= 1 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yleensä selkeämpi > 0, mutta ei tarvi muuttaa, koska sama asia.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tosin tässä voisi olla järkevämpi early return

if ( dropdowns.length === 0 ) {
    return;
}

for (...

if ( dropdowns[ i ].classList.contains( 'active-accordion' ) ) {
dropdowns[ i ].classList.remove( 'active-accordion' );
}
if ( dropdowns.length >= 1 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tähänkin mieluummin early return

@eebbi eebbi merged commit 4a41e8a into master Jun 11, 2024
1 check passed
@eebbi eebbi deleted the TMS-1050 branch June 11, 2024 19:55
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