+
Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Conversation

dylankcrwd
Copy link
Contributor

@dylankcrwd dylankcrwd commented Aug 28, 2024

Updates glide-core-tab-group to align with new design changes relating to overflow button behavior and styling.

Overflow buttons are now disabled when there is no overflow in their direction. Previously they disappeared.

Storybook: https://glide-core.crowdstrike-ux.workers.dev/tabs-overflow-update?path=/docs/tabs--overview

  • Design Reviewed

Before (without overflow buttons):
Screenshot 2024-08-29 at 4 08 06 PM

After (without overflow buttons):
Screenshot 2024-08-29 at 4 08 25 PM

Before (with overflow buttons):

Screen.Recording.2024-08-29.at.4.02.42.PM.mov

After (with overflow buttons):

Screen.Recording.2024-08-29.at.4.04.20.PM.mov

Copy link

changeset-bot bot commented Aug 28, 2024

🦋 Changeset detected

Latest commit: b50cea3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@crowdstrike/glide-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@dylankcrwd dylankcrwd force-pushed the tabs-overflow-update branch from 47aafec to c17a150 Compare August 29, 2024 20:00
@dylankcrwd
Copy link
Contributor Author

dylankcrwd commented Aug 29, 2024

The browser log message An error was thrown in a Promise outside a test. Did you forget to await a function or assertion? has re-appeared and I'm unable to resolve it so far. It happens when ow throws an error when an element other than a glide-core-tab-panel is placed in the default slot via the firstUpdated promise.

@dylankcrwd dylankcrwd changed the title [WIP] fix(tabs, tab-group): design updates to tab overflow buttons fix(tabs, tab-group): design updates to tab overflow buttons Aug 29, 2024
@dylankcrwd dylankcrwd marked this pull request as ready for review August 29, 2024 20:35
@clintcs
Copy link
Collaborator

clintcs commented Sep 3, 2024

The browser log message An error was thrown in a Promise outside a test. Did you forget to await a function or assertion? has re-appeared and I'm unable to resolve it so far. It happens when ow throws an error when an element other than a glide-core-tab-panel is placed in the default slot via the firstUpdated promise.

This is a weird one. It appears to be casually unrelated to similar issues we've seen.

I compared Tab Group to other components that use owSlotType in firstUpdated. The only difference is that Tab Group changes state via its #onNavSlotChange handler. The issue goes away if you comment out those two lines.

If you look at the stack trace (first screenshot), you can see that onNavSlotChange_fn results in a firstUpdated call. Normally, firstUpdated is called directly by Lit and not via a slot change handler. And yet firstUpdated is only called once. So Lit must be batching the state change from #onNavSlotChange into the component's first update.

What's weird is, if you put a breakpoint on firstUpdated, you don't see #onNavSlotChange in the stack (second screenshot). You only see it when it's later logged in the console (first screenshot).

None of that answers the question of why the "unhandledrejection" handler is called.

My guess is that the state change in #onNavSlotChange and the resultant render batching is creating a nested promise somewhere in Lit. And so our try/catch isn't catching it. Something like this is what I assume is happening. Follow that link and open DevTools. Note that the rejection (Promise.reject()) inside the promise callback isn't caught by the try/catch block and so is picked up by the "unhandledrejection" handler.

Probably the best we can do is stub console.error.

image image

@clintcs
Copy link
Collaborator

clintcs commented Sep 3, 2024

Probably the best we can do is stub console.error.

9ecef80

@ynotdraw
Copy link
Collaborator

ynotdraw commented Sep 3, 2024

If you look at the stack trace (first screenshot), you can see that onNavSlotChange_fn results in a firstUpdated call. Normally, firstUpdated is called directly by Lit and not via a slot change handler. And yet firstUpdated is only called once. So Lit must be batching the state change from #onNavSlotChange into the component's first update.

whoa, interesting.

My guess is that the state change in #onNavSlotChange and the resultant render batching is creating a nested promise somewhere in Lit. And so our try/catch isn't catching it. Something like this is what I assume is happening. Follow that link and open DevTools. Note that the rejection (Promise.reject()) inside the promise callback isn't caught by the try/catch block and so is picked up by the "unhandledrejection" handler.

Dang. Nothing to add here. But thanks for doing this and digging in!

Copy link
Collaborator

@ynotdraw ynotdraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

src/tab.group.ts Outdated
// Scroll to within 1px (rounding).
const roundingDelta = 1;
// Scroll to within 1px.
const delta = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the delta here always be the same as line 449? Or is it possible those two can be different?

If they can be the same, you could add const scrollDelta = 1; to the top of the file, add a comment about how it's used, and then update the two locations currently using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@dylankcrwd
Copy link
Contributor Author

Thank you @clintcs for looking into the above issue!

@dylankcrwd dylankcrwd merged commit 18567fb into main Sep 4, 2024
7 checks passed
@dylankcrwd dylankcrwd deleted the tabs-overflow-update branch September 4, 2024 13:34
@github-actions github-actions bot mentioned this pull request Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载