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] Misplacement of the tab indicator if the parent AppBar width change

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

This issue may be related to the issue #8379.

Current Behavior 😯

I use the example of AppBar providing here, I added tabs in the middle of the AppBar. When the side bar is opened, the indicator below the selected Tab is not correct positioned.

As an image worth a thousand words: issue_movie

Expected Behavior 🤔

When I open the side bar, I expect the indicator to be well positioned under the selected Tab.

Steps to Reproduce 🕹

You can find a link to sandbox which reproduce the case. There’s also the same case is this repository.

Steps:

  1. Click on the menu button (top left of the screen),
  2. Pay attention to the position of the Tab indicator,
  3. Click on the left chevron icon to close the side bar,
  4. Pay attention to the position of the Tab indicator.

Your Environment 🌎

Even with the latest releases of material-ui (with sandbox), the behavior is the same.

`npx @material-ui/envinfo`
  System:
    OS: Linux 4.15 Ubuntu 18.04.5 LTS (Bionic Beaver)
  Binaries:
    Node: 13.7.0 - ~/install/node-v13.7.0-linux-x64/bin/node
    Yarn: Not Found
    npm: 6.14.9 - ~/install/node-v13.7.0-linux-x64/bin/npm
  Browsers:
    Chrome: 87.0.4280.66      (I use chrome!)
    Firefox: 83.0
  npmPackages:
    @material-ui/core: ^4.11.2 => 4.11.2 
    @material-ui/icons: ^4.11.2 => 4.11.2 
    @material-ui/styles:  4.11.2 
    @material-ui/system:  4.11.2 
    @material-ui/types:  5.1.0 
    @material-ui/utils:  4.11.2 
    @types/react:  17.0.0 
    react: ^17.0.1 => 17.0.1 
    react-dom: ^17.0.1 => 17.0.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
oliviertassinaricommented, Dec 14, 2020

@frozar In your case, I would apply the action ref and do:

  const actionRef = React.useRef();

  React.useEffect(() => {
    const timeout = setTimeout(() => {
      actionRef.current.updateIndicator();
    }, theme.transitions.duration.enteringScreen);

    return () => {
      clearTimeout(timeout);
    };
  }, [open, theme]);

  //…

  <Tabs action={actionRef} />

https://codesandbox.io/s/practical-payne-s2pkw?file=/src/index.js:2725-2998

0reactions
frozarcommented, Dec 14, 2020

When I read the previous issues, I realise that there is a lot written on this topic and that is still a hot topic.

As this issue is popular, it would be really helpful to have a basic example of the updateIndicator() method. It would save a lot of time to many people and also provide a concrete example of the current recommended work around on this issue.

@oliviertassinari Can you fix the basic case I provided in my sandbox link to show how to use updateIndicator() method please?

I would really like to contribute to material-ui lib but I’m honestly, I’m not ready for this. There’s still a lot of things that doesn’t fit in my head currently ^^’

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tabs] Misplacement of the tab indicator if the parent AppBar ...
I use the example of AppBar providing here, I added tabs in the middle of the AppBar. When the side bar is opened,...
Read more >
How to change tabs width in material UI - Stack Overflow
If you want tabs of fixed width, you need to override the root css class passed to the Tab component, where you have...
Read more >
Flutter TabBar: A complete tutorial with examples
How to customize the tab indicator in TabBar; Making scrollable tabs with TabBar; Changing tabs programmatically; Listening for tab change event ...
Read more >
Release Notes for Office Current Channel (Preview)
We fixed an issue where Excel would incorrectly use a fixed width rather than the full width space when converting text to column....
Read more >
Overlay - PTC Support
Holemaking Cycle Types and Tabs ... To Display the Manufacturing Parent/Child Relationships ... About Length versus Thickness Indicator.
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