Skip to content

[Tabs] Ink bar needs to be adjusted after fonts load #4648

Closed

Description

@macjohnny

Bug, feature request, or proposal:

Bug

What is the expected behavior?

The ink bar for the tabs should be positioned correctly, even when using web fonts.

What is the current behavior?

When using a web font for the tab titles, the ink bar position/length is not calculated correctly on initialization. Clicking the currently active tab again or a different tab repositions the ink bar correctly.
bildschirmfoto 2017-05-18 um 13 35 59
If you click it again, it aligns correctly.
bildschirmfoto 2017-05-18 um 13 36 04

This is due to the web font not being present when the component is initialized and the ink bar position is calculated. When clicking the tab again, the web font is displayed correctly and hence the position is calculated correctly.

What are the steps to reproduce?

https://embed.plnkr.co/eOW495nHUT82YyKZt9Qt/
Throttle the network to 2G, to simulate a loading delay of the web font.
bildschirmfoto 2017-05-18 um 13 36 46

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

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

Angular4, material 2.0.0-beta.5

Activity

  1. changed the title [-]Bug(MdTabs): Tab Ink Bar position not correctly initialized when using web fonts[/-] [+][Tabs] Ink bar needs to be adjusted after fonts load[/+] on Oct 19, 2017
  2. added
    P4
    and removed on Oct 19, 2017
  3. gioele-antoci commented on Mar 13, 2018

    @gioele-antoci
    @ViewChild(MatTabNav) navBar: MatTabNav;
    document.fonts.ready.then(function() { this.navBar._inkBar.alignToElement(this.navBar._activeLinkElement.nativeElement) })```
    
    In the meanwhile something like this would do it.
  4. aicokleinovink commented on Nov 29, 2019

    @aicokleinovink

    Something new on this issue? Ran into exactly the same thing with Angular Material 8+

  5. removed their assignment
    on Jun 3, 2023
  6. crisbeto commented on Jun 23, 2025

    @crisbeto
    Member

    This shouldn't be a problem anymore, because the ink bar width is set using a percentage.

  7. self-assigned this
    on Jun 23, 2025
  8. angular-automatic-lock-bot commented on Jul 24, 2025

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P4area: material/tabs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions