-
Notifications
You must be signed in to change notification settings - Fork 1
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
Expanded default item #12
Comments
To deliver the feature, I'd propose using |
👍 |
Has been already implemented, just add the defined panelActiveClass to the panel that should be open initially. |
I think since we're dealing with a component, we should think in component space as opposed to representation space. API bindings over data attributes would IMO be more appropriate and how it's done in most cases.
|
What is more easy than setting a class? |
Setting a class is not easy. It involves CSS and JS. CSS should be used for representation not function. If no class is given, component should still remain functional. Setting a requirement on a class setting couples function with presentation. So it is not easy, and it is prone to error. |
You can set it when outputting the markup, so in the template. I do not see the problem here. The whole component is build upon classes, they are needed for the accordion to work. It has to find its panels and the connected content and trigger classes, they also have to be set, so while iterating over the accordion panel item data which comes from backend it should be easy to set an additional active class in the frontend. |
Class-based API is generally a bad idea. Internally, organised classes make a nice way to do it, but revealing an API over classes is not going to work. Here's why:
%ul{data: {component: 'iptAccordion', component-options" => '{"panelActiveClass": "expandable__list__item--active"}'
- list_items.each |list_item, index|
%li{ :class => ("expandable__list__item--active" if index == 0) } For these reasons I'll reopen the ticket for feature development as originally planned. |
…nd-over-data-attribute-12 Resolve #12 Expanded default item
Feature request: user would like to have one accordion item expanded by default as the page has loaded.
The text was updated successfully, but these errors were encountered: