-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix(#2109): tabs query string, loading 1st tab issues #2241
base: alpha
Are you sure you want to change the base?
Conversation
03b16ad
to
fdaf49b
Compare
The function of this issue is verified on react and on angular. One thing we noticed is there are 2 additional line for console.log in the code |
I will remove those console.log statements and update the PR shortly. |
fdaf49b
to
20b408d
Compare
1025c86
to
7e59286
Compare
Hi @kevingauld , I have updated this PR and made changes to the getTabNumberFromHash() method. Can you please test again? I have added playground code. Thare is a commented code section for the 'tabs within tabs scenario', which is not recommended.... therefore code has been commented out. |
Hi Team, this issue is verified for react and angular. Tab inside tab is out of scope and not verified, loading first tab, and initial tab is verified |
7e59286
to
135f0f8
Compare
cc2da93
to
8d8c059
Compare
03a30f6
to
e5720cc
Compare
As discussed in the Dev meeting, we check for the tab indicated in the url (e.g. "/tab-0") one time only.... in the beginning. |
Story-2109-20241203.mp4 |
e5720cc
to
11d0e76
Compare
@@ -80,9 +82,11 @@ describe("Tabs", () => { | |||
|
|||
// last tab | |||
await waitFor(() => { | |||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure that the block within the timeout is run when; can you confirm that these tests are run. Because if they are being skipped it is a little bit of a false positive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the setTimeout and PR updated, good thing is the tests passed.
@@ -56,6 +56,7 @@ describe("Tabs", () => { | |||
const result = render(Tabs, { initialtab: 2 }); | |||
|
|||
await waitFor(() => { | |||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below as it applies here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the setTimeout and PR updated, good thing is the tests passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see the setTimeout
|
||
// Find the matching tab based on href | ||
const tabs = _tabsEl?.querySelectorAll('[role="tab"]'); | ||
if (!tabs) return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really needed as the querySelectorAll function will always return either an empty array or one that contains data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR has been updated
tab.getAttribute("href")?.endsWith(hash) || | ||
hash.endsWith(tab.getAttribute("href")?.split("#")[1] || "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these if
conditions it would be easier to understand if these conditions were extracted out to a descriptive var name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR has been updated
511d04f
to
b8d4c3c
Compare
b8d4c3c
to
cb24434
Compare
Before (the change)
After (the change)
-If query string is present, it should be preserved.
-Indicated tab should be honoured.
Make sure that you've checked the boxes below before you submit the PR
Steps needed to test
Angular playground code