Skip to content

Tabs: Don't allow navigating to hidden tabs#1724

Closed
scottgonzalez wants to merge 1 commit into
jquery:masterfrom
scottgonzalez:tabs-hidden
Closed

Tabs: Don't allow navigating to hidden tabs#1724
scottgonzalez wants to merge 1 commit into
jquery:masterfrom
scottgonzalez:tabs-hidden

Conversation

@scottgonzalez
Copy link
Copy Markdown
Member

Fixes #15013

@mention-bot
Copy link
Copy Markdown

@scottgonzalez, thanks for your PR! By analyzing the annotation information on this pull request, we identified @apsdehal, @arschmitz and @jzaefferer to be potential reviewers

Comment thread ui/widgets/tabs.js
return false;
}

if ( that.tabs.eq( index ).is( ":hidden" ) ) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about...

return that.tabs.eq( index ).is( ":visible" )

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When there are multiple failure cases, I generally like to list them out individually as failure cases, then return true at the end, but I'm fine making this change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a thought but the :visible and :hidden selectors are pretty slow and not 100% reliable. We don't document that hidden tabs are automatically not navigable. Would it perhaps be better to leave this change out and document that you should mark hidden tabs as disabled?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually, for some reason switching it causes the tests to fail.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't document that hidden tabs are automatically not navigable.

Why would anyone ever expect a hidden tab to be navigable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think they would which is why i suggested documenting that hidden tabs should be marked disabled

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jzaefferer
Copy link
Copy Markdown
Member

Besides that one thing, 👍

@scottgonzalez
Copy link
Copy Markdown
Member Author

I'm going to close this because this will result in an odd state of tabs not being marked as disabled, but also not being able to be activated properly. Instead, we should implement the hidden detection inside refresh() and set those tabs as disabled.

@scottgonzalez scottgonzalez deleted the tabs-hidden branch May 2, 2017 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants