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

nested accordions need stoppropagation in click handler #15

Merged
merged 1 commit into from Feb 14, 2017

Conversation

Projects
None yet
2 participants
@MEDIUM-ch
Contributor

MEDIUM-ch commented Feb 13, 2017

For a project we needed nested accordions (if that makes sense at all is another discussion ;).
To set this up I prepared the accordions (with class js-accordion) as following:

$('.js-accordion').each(function(i, e) {
  var $a = $(this)

  $a.attr('id', 'ACCORDION-' + i).accordion({
    headersSelector: '>.js-accordion__header',
    panelsSelector: '>.js-accordion__panel'
  });
})

so each accordion gets an ID and the headers and panels selector use the child only selector (this could be change in defaultConfig but not sure if this makes other problems.

But the click handler needs the stopPropagation call to prevent closing the outer accordion as set in the PR.

Is there anything else I oversee? Not sure how to reach the inner accordion with the keyboard, guess that would be an open issue. Any feedback welcome, this is apart from this admittedly strange requirement we had a very nice solution!

@nico3333fr nico3333fr merged commit a7c8f34 into nico3333fr:master Feb 14, 2017

nico3333fr added a commit that referenced this pull request Feb 14, 2017

V 2.2.1
- Fixed an issue in nested accordions #15
- Fixed an issue in previous issue :)
- Added version in JS

nico3333fr added a commit that referenced this pull request Feb 14, 2017

V 2.2.1
- Fixed an issue in nested accordions #15
- Fixed an issue in previous issue :)
- Added version in JS
@nico3333fr

This comment has been minimized.

Show comment
Hide comment
@nico3333fr

nico3333fr Feb 14, 2017

Owner

No problem, it is also rare for me to nest accordions/tabs/etc., however, it might happen too.

Thanks ! ;)

Owner

nico3333fr commented Feb 14, 2017

No problem, it is also rare for me to nest accordions/tabs/etc., however, it might happen too.

Thanks ! ;)

@MEDIUM-ch

This comment has been minimized.

Show comment
Hide comment
@MEDIUM-ch

MEDIUM-ch Feb 14, 2017

Contributor

thanks for the quick action :)

regarding the keyboard navigation, is there anything that should be done in the code? I am absolutely unsure if I mess up the "accessible" in the accessible accordion :/ Should only happen if nested though so normal behaviour should work as before. Any hints from your side? Thanks a lot!

Contributor

MEDIUM-ch commented Feb 14, 2017

thanks for the quick action :)

regarding the keyboard navigation, is there anything that should be done in the code? I am absolutely unsure if I mess up the "accessible" in the accessible accordion :/ Should only happen if nested though so normal behaviour should work as before. Any hints from your side? Thanks a lot!

@nico3333fr

This comment has been minimized.

Show comment
Hide comment
@nico3333fr

nico3333fr Feb 14, 2017

Owner

I don't know, I have to test, will do it asap. ;)

Owner

nico3333fr commented Feb 14, 2017

I don't know, I have to test, will do it asap. ;)

@MEDIUM-ch

This comment has been minimized.

Show comment
Hide comment
@MEDIUM-ch

MEDIUM-ch Feb 14, 2017

Contributor

great, thanks! If you Need any more input let me know

Contributor

MEDIUM-ch commented Feb 14, 2017

great, thanks! If you Need any more input let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment