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

Tabs tab indicator missing on load #2102

Closed
joxmar opened this issue Sep 29, 2015 · 14 comments
Closed

Tabs tab indicator missing on load #2102

joxmar opened this issue Sep 29, 2015 · 14 comments

Comments

@joxmar
Copy link

joxmar commented Sep 29, 2015

I'm having issues with the tabs, the tab indicator is missing when the tabs are loaded, The first tab is the default and the tab text is colored as selected tab and displaying the correct content but the indicator is missing. There's only 2 ways to get the indicator to show:

  1. When I start clicking on the tabs the indicator appears and then stays working correctly
  2. When the tabs load and I re-size the window the indicator appears

this is what I have:

<div class="container">         
  <div class="row">
    <div id="rmt-rooms" class="col s12 m3">
     Some stuff
    </div>      

    <!-- tabs -->
    <div id="rmt-dialog" class="col s12 m9">
      <div class="card-panel">
        <div class="row">
          <div class="col s12">
            <ul class="tabs">
              <li class="tab"><a href="#roomType" class="active">Room Type</a></li>
              <li class="tab"><a href="#roomPhotos">Room Photos</a></li>        
              <li class="tab"><a href="#roomNumbers">Room Numbers</a></li>
            </ul>
          </div>
          <div id="roomType" class="col s12"></div>
          <div id="roomPhotos" class="col s12"></div>
          <div id="roomNumbers" class="col s12"></div>
        </div>                      
      </div>                        
    </div>  
    <!--End  tabs -->                       
  </div>
</div>
@gnicol-bzh
Copy link

I have the same problem.

~since Chrome 44 (didn't use tabs on older Chrome,46 currently)
~Windows 7
~haven't tried on other browser yet

@evallgar
Copy link

It also fails on OS X Firefox 41.0.2 and Safari 9.0.1

I dont think its a browser issue.

@loolooii
Copy link

I have the same problem! Is there any fix for this?

@ghost
Copy link

ghost commented Jan 20, 2016

This issue is hard to reproduce

@loolooii
Copy link

@chifreaigle I have a tab somewhere inside another (main) tab, maybe that helps? Also, the class "active" is correctly set. Only left:x and top:y are set after actually clicking on a tab (which then shows the indicator color).

@ghost
Copy link

ghost commented Jan 20, 2016

@loolooii Yeah,i got the steps to reproduce the issue, when making a tab(secondary tab) inside an other tab(main tab) makes the indicator of the secondary tab invisible, as @joxmar said the only way to get it showing is by either resizing or selecting the tab,Here is an example
https://jsfiddle.net/80jkvumd/
EDIT: you cant see the issue on fiddle you have to copie that in a real html file(dont forget resources like mrl.css mtr.js and jquery)
EDIT2: as @evallgar said, This NOT a browser issue.

@julianctni
Copy link

Just got the same issue. Tab indicator not showing, only after resizing the window. Is there any workaround or solution meanwhile?

@adamhammond
Copy link

@julianctni for a quick fix, you could:

At the end of your event handler for $(document).ready, add the following:
window.dispatchEvent(new Event('resize'));

@ghost
Copy link

ghost commented Feb 10, 2017

I can't do that because my tabs are in a modal. It makes the indicator the entire width of the tabs. (underlines all tabs end to end)

@ghost
Copy link

ghost commented Feb 10, 2017

Nevermind, I just put @adamhammond 's one-liner in the modal::ready callback

@mangakid
Copy link

I had the same issue, also with the tabs in a modal, the solution I used was:
$('#my-modal').modal({
ready: function(modal, trigger) {
$('ul.tabs').tabs();
}
});

@joxmar joxmar closed this as completed Feb 14, 2017
@abraaoz
Copy link

abraaoz commented Mar 4, 2017

If you are using tabs inside "collapsible" elements, you must apply @adamhammond fix inside "onOpen" event, like this:

$('.collapsible').collapsible({
	onOpen: function(el) {
		// https://github.com/Dogfalo/materialize/issues/2102
		window.dispatchEvent(new Event('resize'));
	}
});

alberthdev added a commit to CE-Programming/CEmu that referenced this issue Jan 28, 2018
 * Fixed overlay on mobile menu. Materialize isn't clear on navbar
   mobile location, but some bug reading shows that it should be moved
   out of the div and place it as its own entity. See:
   Dogfalo/materialize#2879

 * Fixed mobile menu width. See:
   Dogfalo/materialize#2102

 * Merge downloads pages and instead add a sub-tab for stable
   releases. (This required some quirky workarounds for tab
   behavior... see: Dogfalo/materialize#2102)

 * Subtab support also forces a special CSS class to workaround
   issues in Materialize. (Talk about buggy...)
   See: Dogfalo/materialize#4029
@makindemayowa
Copy link

makindemayowa commented Feb 12, 2018

This worked for me.
$(document).ready(function(){ $('ul.tabs').tabs(); });

@dinho19sp
Copy link

This worked for me, i'm using angular 6, this tab not work with route-outlet.. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants