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

Trying to address paper-tabs issues #1048

Merged
merged 23 commits into from
Mar 1, 2019

Conversation

panthony
Copy link
Contributor

@panthony panthony commented Jan 12, 2019

Hopefully:

I'm trying to take a fresh start at paper tabs offsets handling as they are may issues at the moment.

If they are things that I'm missing feel free to tell me.

Amongs the hopefully fixed issues:

  • infinite rendering
  • movingRight that is not properly set
  • currentOffset that may not be set
  • inkBar that may be rendered without proper left/right offset
  • lot's of (I think) unnecessary 'updateXXX' calls

Issues yet to be fixed:

  • when you paginate, it triggers a re-render that eventually calls 'fixOffset' which 'cancel' the pagination because it caused the selected tab to be partially hidden 😭

edit:

To correct this 'fixOffset' issue that breaks the pagination I now call it in only 2 cases:

  • upon first render to ensure the selected tab is visible
  • upon selected tab update to put the whole tab in focus

I'm not calling it anymore in 'didRender' which means that if the tab's label is updated while selected it might become partially hidden but this is way WAY minor IMO.

edit²:

Unfortunately I do not have time for this right away but I think we should add some tests with a wrapper around "paper-tabs" with a small max width, to ensure that we can still paginate around.

@panthony
Copy link
Contributor Author

panthony commented Jan 13, 2019

edit: worked around by not calling 'fixOffset' in didRender

1 similar comment
@panthony
Copy link
Contributor Author

panthony commented Jan 13, 2019

edit: worked around by not calling 'fixOffset' in didRender

@panthony panthony changed the title [WIP] Trying to address paper-tabs issues Trying to address paper-tabs issues Jan 14, 2019
panthony and others added 23 commits January 14, 2019 15:24
Doing this avoid, on render where the selected tab is NOT the first tab, to have the inkBar quickly starting from offset 0 to the actual selected tab.
By defaults, assume this is true.
This is unnecessary because we already have the hook
in paper-tabs that:

- is always called after one of the tab didRender
- calls 'updateDimensions' on all of its children
As it will be done directly after in didRender
Because didRender will be called and will call this method too.
Because when navigating there is a render without
any selected tab
Because we pass 'selected' to each of them, updating
the selected tab will invalidate all the 'isSelected'
property which will trigger an validation of
_selectedTab (thus observer callback) for each nested tab
Only do it in two occasions:

- first render
- selected tab was updated

Otherwise it will prevent user's pagination as the selected tab will
become partially hidden.
@chbonser
Copy link
Contributor

chbonser commented Jan 21, 2019

@panthony I pulled in your changes into a project and it resolved an issue for me where the next/previous buttons were disabled when they shouldn't have been. I'll do some more testing, but I see no issues so far.

@betocantu93
Copy link
Contributor

@panthony sorry for the delay, I also pulled your tag and it works, gonna keep testing my use cases, and will let you know, thanks for the effort

@pauln
Copy link
Contributor

pauln commented Feb 21, 2019

I spotted this PR after submitting my own to fix the pagination issues. I can confirm that this fixes #1063 for me, as well as the other issues listed in the OP.

@miguelcobain miguelcobain merged commit 71f0bb1 into miguelcobain:master Mar 1, 2019
@miguelcobain
Copy link
Owner

Thanks a lot @panthony. Sorry for taking so long to review. This looks great!

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