question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tabs: When the selectedIndex is changed, if focus is on a tab, focus should move to the now-selected tab

See original GitHub issue

Bug, feature request, or proposal:

When the selectedIndex property of an MdTabGroup is changed so that another tab is opened, if the focus is on a tab within the MdTabGroup’s tab header, focus should move to the now-selected tab.

Alternatively, I would like the MdTabGroup’s tab header child component to be exposed so that I could update the focusIndex.

What is the current behavior?

Currently, when the selectedIndex is changed to open a different tab while the focus is on one of the tabs, focus remains on the tab.

What are the steps to reproduce?

Please see this Plunker: http://plnkr.co/edit/xNUO08jgFcFCsdWDzCRZ

In this Plunker, I integrated a Material Design tabs component with routing, so that clicking on a tab changes the URL, and visiting a certain tab’s URL will cause the tab to be opened.

  1. Run the Plunker that I linked to. Click the “Launch the preview in a separate window” button to see the changing URLs.
  2. When you see the tabs rendered, click on “Tab 3” to open the third tab.
  3. Right click on “Tab 3” and select “Back” from the context menu (in Firefox, the “back” menu item is just an arrow icon).
  4. The blue tab underline will move to “Tab 1” and the first tab will be opened; however, the focus is still on “Tab 3”.

What is the use-case or motivation for changing an existing behavior?

I would like to be able to move the focus to the now-selected tab.

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.3.1, Angular Material 2.0.0-beta.1

I have tested Safari 10.0.3, Firefox 51.0.1 (64-bit), and Chrome 56.0.2924.87 (64-bit).

Is there anything else we should know?

See this thread on JavaRanch for some background: https://coderanch.com/t/675876/access-grandchild-component-Angular

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
antonmoiseevcommented, Feb 8, 2017

A picture is worth a thousand words 😉 tab

0reactions
angular-automatic-lock-bot[bot]commented, Jun 2, 2021

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control focus with tabindex - web.dev
Try pressing the Tab key to navigate through your site. Are you able to reach all the interactive controls on the page? If...
Read more >
How to automatically move focus when selectedindex tab ...
This event handler will move the focus to the next TabItem when tab key is pressed. private void TextBox_PreviewKeyDown(object sender, ...
Read more >
Controlling focus with tabindex -- A11ycasts #04 - YouTube
Whenever possible you want to use native HTML elements for your custom controls. The button tag, for instance, is very easy to style, ......
Read more >
How to set focus on Shift +Tab and Tab accordingly ? - MSDN
I have 4 dropdowns,. I want to set focus according to Tab and Shift+tab after postback. If i press shift+tab it should focus...
Read more >
How to Prevent Tab Indexing on Specific Elements - W3docs
If the value is negative, the user agent will set the tabindex focus flag of the element, but the element should not be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found