paper-tabs icon indicating copy to clipboard operation
paper-tabs copied to clipboard

Initial selected item is not highlighted

Open sevcsik opened this issue 10 years ago • 15 comments
trafficstars

When I set the selected attribute the first time (e.g. hardcoding it in the markup, or binding it to a property which has value whe the element is attached), the selected tab is not highlited with the selection bar.

If I changed the selected attribute afterwards, it works fine.

(version 1.0.0)

sevcsik avatar Jun 05 '15 22:06 sevcsik

Looks like the problem is that for the first _onTabChanged call, here, we get a 0x0 rectangle:

      var r = this.$.tabsContent.getBoundingClientRect();

which results in a division by zero few lines later.

Which happens because the initial iron-select event gets triggered before my paper-tabs element is attached to the DOM (it's behind a dom-if template in my case).

sevcsik avatar Jun 05 '15 23:06 sevcsik

I have no issue with selection bar. But tab label text is not bold (on initial selection), even when I manually set paper-tab focused property to true. In subsequent selections, tab label text is correctly bold.

seahrh avatar Jun 14 '15 12:06 seahrh

same issue here

blerest avatar Jun 15 '15 13:06 blerest

I fixed this in PR https://github.com/PolymerElements/paper-tabs/pull/32 but I'm yet to add tests. I suspect that the same issue is causing what @seahrh reported.

@seahrh, can you check it with my branch: https://github.com/sevcsik/paper-tabs/tree/patch-1?

sevcsik avatar Jun 15 '15 13:06 sevcsik

Can we see about getting this merged? It has been months and it has now been hit by several users. Mentioning @cdata to get some team members attention that has been active in this repo :)

ktiedt avatar Sep 01 '15 21:09 ktiedt

Worth noting, I worked around this in my case by adding:

this.$.tabs._selectSelected();

to the last line of my tabs parent elements attached() callback. I realize this is calling private API but it was a temporary (hopefully) solution to the problem.

ktiedt avatar Sep 01 '15 21:09 ktiedt

+1

ronnyroeller avatar Sep 28 '15 09:09 ronnyroeller

Hi, this issue should be fixed. Please re-open if it is not!

cdata avatar Oct 28 '15 21:10 cdata

Still doesn't work for me.

ronnyroeller avatar Nov 06 '15 22:11 ronnyroeller

Still not working

davetii avatar Jan 10 '17 15:01 davetii

In 2.0 this is still not working!

DarkSideOfMo0n avatar Jun 12 '17 13:06 DarkSideOfMo0n

Still not working.

The only workaround that works for me is calling notifyResize() in a setTimeout of 1 ms.

thepassle avatar Jul 10 '18 13:07 thepassle

@bicknellr @frankiefu @notwaldorf @e111077 this seems like it should be re-opened. Could one of you pls take a look when possible, or let me know who to ping? Thanks!

ghost avatar Aug 08 '18 05:08 ghost

Indeed still not working. The notifyResize() from a setTimeout isn't a 100% work-around either. I've seen it work, but after adding some more (other) components, it broke, and I can't get it back :(

srijken avatar Aug 08 '18 20:08 srijken

The notifyResize() with a setTimeout also didnt solve it for all browsers i later found out.

We've recently switched our project to a build with webpack, and mysteriously the issue isnt present anymore. Maybe that points someone in the right direction?

thepassle avatar Aug 08 '18 20:08 thepassle