Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Content prefix #6

Merged
merged 5 commits into from
Mar 8, 2016
Merged

Content prefix #6

merged 5 commits into from
Mar 8, 2016

Conversation

noahmanger
Copy link
Contributor

Adding the ability to set custom prefixes for the IDs of the content divs. This allows you to have more than one accordion instance on a page.

@@ -39,7 +45,7 @@ Accordion.prototype.findTriggers = function() {
};

Accordion.prototype.setAria = function(trigger, index) {
var contentID = 'content-' + index;
var contentID = this.opts.contentPrefix + '-' + 'content-' + index;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want the accordion to set IDs for all the trigger elements? What about letting users set button IDs in their markup instead? Then the setAria method can check for an ID, and if it's present, update ARIA attributes. That way, we wouldn't be changing IDs of existing elements, which I think would be a good thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I update this. I added a check to see if there's already IDs set, and if so, use those. I think it's convenient to not have to worry about setting them and let the library do it programmatically (as in the case of a really long list, like the glossary). But good call on not changing things if they already exist.

Noah Manger added 2 commits March 7, 2016 15:45
- Removing org scope from package name
- Fixing failing tests
- Check for existing ID on content divs and use that if it exists

h/t @jmcarp
@noahmanger
Copy link
Contributor Author

Thanks for the review @jmcarp . Made the change and updated the readme.

@jmcarp
Copy link
Contributor

jmcarp commented Mar 8, 2016

Looks fine to me @noahmanger. I'd merge, but I don't have permission.

noahmanger pushed a commit that referenced this pull request Mar 8, 2016
@noahmanger noahmanger merged commit bc35000 into master Mar 8, 2016
@noahmanger
Copy link
Contributor Author

Thanks. Merged.

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

Successfully merging this pull request may close these issues.

2 participants