fix(Tabs): enable tabs scroll button for small window#6784
fix(Tabs): enable tabs scroll button for small window#6784nicolethoen merged 4 commits intopatternfly:mainfrom
Conversation
dlabrecq
left a comment
There was a problem hiding this comment.
Other than the Lodash issue, it LGTM
|
Do we know how this Also, do we know of any use-cases where we would want |
| * @returns { boolean } True if the component is in View. | ||
| */ | ||
| export function isElementInView(container: HTMLElement, element: HTMLElement, partial: boolean) { | ||
| export function isElementInView(container: HTMLElement, element: HTMLElement, partial: boolean, strict?: boolean) { |
There was a problem hiding this comment.
I'm thinking it might be better to default this value to false, so strict: boolean = false so we don't have to count on undefined being checked correctly down below.
There was a problem hiding this comment.
Will update, thanks!
Yes, the same problem also exists on
Currently, my answer is no. But I prefer to keep this prop. If they want to check whether an element is inside a container in the future in some other situations this could help. |
|
Thanks for clarifying! |
|
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #5175
This issue is because there the button only scrolls left or right when the tab is totally inside the view. However, when the window is small, the tab content could even be longer than the list width, which makes it can never find the element in the view. To solve the problem, I created a new optional prop named
strictand made a judgment on the element width and the container width, if the container width is smaller than the element width and thestrictis not set, we treat it as part in view. Only when strict mode is set, we will not take the element width and container width into consideration, which brings more flexibility to the function.Also, I update the bounding to make it more precise to judge whether an element is in view when the element width is not an integer. And add a debounce to the scroll function.