-
Notifications
You must be signed in to change notification settings - Fork 356
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
Convert settings tabs to React #8956
Conversation
3dc47fd
to
db33510
Compare
db33510
to
75e0eb4
Compare
Hey @GilbertCherrie , I just noticed a delay in rendering the default tab. It's there in the master branch as well. I can see 2 apis running in the background.Can we introduce some sort of loading/spinner in here. Screen.Recording.2023-11-22.at.10.26.49.AM.mov@DavidResende0 , could you also check when you are back? |
553f2d8
to
aa0ac2f
Compare
useEffect(() => { | ||
const tempTabs = []; | ||
tabs.forEach((tab, index) => { | ||
if (tab[0] === currentTab) { | ||
setSelectedTab(parseInt(index, 10)); | ||
} | ||
|
||
tempTabs.push( | ||
<Tab | ||
key={tab[0]} | ||
id={tab[0]} | ||
className={`${tab[0]}` === currentTab ? 'selected' : 'not-selected'} | ||
label={__(tab[1])} | ||
onClick={() => onTabClick(tab[0])} | ||
/> | ||
); | ||
}); | ||
setTabsList(tempTabs); | ||
}, []); |
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 have a doubt with the setSelectedTab
in this useEffect
. So this is going to render the component again.
Should we use another useEffect
for handling array operation and handle the setTabsList
}, [showConfirm]); | ||
|
||
return ( | ||
<div> |
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.
do we need this div
?,
or maybe we can assign a className
if its really needed.
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.
We do need it since if we remove it there will be 2 parent elements which are the modal and tablist. This will cause an error so we need to wrap them in a parent div
if (showConfirm) { | ||
document.getElementsByClassName('selected')[0].classList.remove('bx--tabs--scrollable__nav-item--selected'); | ||
} else if (document.getElementsByClassName('selected').length > 0) { | ||
fixTabStyling(); |
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.
Same here, should we do another useEffect
for the showConfirm
to handle the fixTabStyling
which would also handle the onSecondarySubmit
in the <Modal>
bce3bfc
to
bd3fee1
Compare
bd3fee1
to
f493067
Compare
dda6b66
to
ab37884
Compare
To avoid merge conflicts and backport errors lets merge this pr: #8969 first. |
05edebb
to
b37c6c9
Compare
6e2e23c
to
4b4f15f
Compare
Checked commit GilbertCherrie@4b4f15f with ruby 2.7.8, rubocop 1.56.3, haml-lint 0.51.0, and yamllint app/controllers/configuration_controller.rb
app/views/layouts/_tabs.html.haml
|
0feeea2
to
7b3f54b
Compare
7b3f54b
to
affdd72
Compare
Skipping backport to |
Converted Settings > My Settings tabs to React. React tabs are now keyboard accessible.
Before:
![Screenshot 2023-11-21 at 3 36 22 PM](https://private-user-images.githubusercontent.com/32444791/284710040-27fe0e34-1728-49d5-8c3b-4baedf541a04.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyOTE2MzEsIm5iZiI6MTczOTI5MTMzMSwicGF0aCI6Ii8zMjQ0NDc5MS8yODQ3MTAwNDAtMjdmZTBlMzQtMTcyOC00OWQ1LThjM2ItNGJhZWRmNTQxYTA0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDE2Mjg1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFlNTVmYTNjNzY4ZDM2ZmZmZjE2YmZjZGU5MGIyZDQ4MDhmMTMzZTJhYjVhZTdlZjQxNzQ3ODNjMGFiZGE3YzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.9X1u_fN8rGR-1whhyqGtrqW7I3_QMx1kZcxk8pWsPQc)
![Screenshot 2023-11-21 at 3 35 31 PM](https://private-user-images.githubusercontent.com/32444791/284709981-f9a49db4-4e2d-462a-b3c3-860280256fb6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyOTE2MzEsIm5iZiI6MTczOTI5MTMzMSwicGF0aCI6Ii8zMjQ0NDc5MS8yODQ3MDk5ODEtZjlhNDlkYjQtNGUyZC00NjJhLWIzYzMtODYwMjgwMjU2ZmI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDE2Mjg1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAxZGYwZTlkYjg5MjFkOTQyNTk5ODJmODEzYmRmNjAzMTg2ZDIzOGY5YmY5ZGM4YTE0NDZlMTJlYzVmM2I0MmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0._OfN7uRRoe_wg5HYhECZQ96BoxKh6DF4mWehlQDLLXQ)
After:
![Screenshot 2023-11-21 at 3 28 13 PM](https://private-user-images.githubusercontent.com/32444791/284708700-f4e57f57-4cb2-4519-91fe-df3fc3bb8f0c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyOTE2MzEsIm5iZiI6MTczOTI5MTMzMSwicGF0aCI6Ii8zMjQ0NDc5MS8yODQ3MDg3MDAtZjRlNTdmNTctNGNiMi00NTE5LTkxZmUtZGYzZmMzYmI4ZjBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDE2Mjg1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyMWNhNjgzNmJmY2UzNDMxYjVjOWQ3ZTkxYmIwNWQzNGRlMWNkNDY5MzE3MDcwZjg3ZGM3MjE3MzgzYmViNGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.NJPjoWG5jQ6BvPItadExLmyK-HSbe_YpEt0GX2rtz90)
![Screenshot 2023-11-21 at 3 32 04 PM](https://private-user-images.githubusercontent.com/32444791/284708932-230f4cea-0664-4c0e-982c-6e1190e2fe0d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyOTE2MzEsIm5iZiI6MTczOTI5MTMzMSwicGF0aCI6Ii8zMjQ0NDc5MS8yODQ3MDg5MzItMjMwZjRjZWEtMDY2NC00YzBlLTk4MmMtNmUxMTkwZTJmZTBkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDE2Mjg1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0MzhmZjM1OWNkZTdlN2E1MGZlYmM1MDU3NzY0NDEzYTc0ODRjN2QzODdiN2ViMWNiZjVmYTFkYzI5MzRhZjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.teyvBMBlzgmkepb5Ljbo_mUIRKBJV69TwA_YL012xvQ)