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

data-open do not need "true" as value #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Basic HTML structure with roles `tablist`, `tab`, and `tabpanel`.

An `aria-disabled` attribute set to `true` on a `tab` will disable the `tab` and the associated `tabpanel` making them unfocusable and unselectable.

If you wish to open one specific tab when the script starts, just add the `data-open` attribute with the value of `true` on the desired `tab`:
If you wish to open one specific tab when the script starts, just add the `data-open` attribute on the desired `tab` (without any value or with every other value than `"false"`, it will be considered as `true`):

```html
<ul role="tablist">
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class Tablist{
tab.disabled = tab.hasAttribute( 'disabled' ) || tab.getAttribute( 'aria-disabled' ) === 'true';

// if there's no opened tab yet
if( tab.getAttribute( 'data-open' ) === 'true' && !tab.disabled ){
if( tab.hasAttribute( 'data-open' ) && tab.getAttribute( 'data-open' ) !== 'false' && !tab.disabled ){
if( this._tablist.openedIndex === undefined ){
this._toggleDisplay( index, true );

Expand Down