-
Notifications
You must be signed in to change notification settings - Fork 8
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
Uds 1793: Fix onclick in header navtree #1342
Conversation
If a navtree link does not have an href, check to make sure onclick is called
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 tested with sublinks and they're not clickable by keyboard or mouse. The tabindex="0"
isn't applying to the sublinks also, so they aren't focusable.
Per @scott-williams-az , it appears sublinks never supported onClick behaviors.
code I used for navTree
to illustrate this:
const myNavTree = [
{
text: "Home",
selected: false,
onClick: () => {
console.log("Home clicked");
},
},
{
text: "Test 1",
selected: false,
onClick: () => {
console.log("Test 1 clicked");
},
},
{
text: "Fun",
selected: false,
onClick: () => {
console.log("Test 2 clicked");
},
},
{
text: "Link option 1",
href: "#",
items: [
[
{
text: "Sublink 1",
selected: false,
onClick: () => {
console.log("Sublink 1 clicked");
},
},
{
href: "https://www.asu.edu/",
text: "Sublink 2",
},
],
],
},
];
I cleaned up the dropdown component a bit and added the onClick event |
Circular dependency: The DropdownItem component file is just pulling in the LINK_DEFAULT_PROPS, and we're getting other eslint errors about the props, so perhaps the DropdownItem component file just needs to do its own thing for the link props? |
e0ca3bd
to
d071db0
Compare
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.
Issues resolved! Thanks, @davidornelas11
Description
fixed navtree with onclick not getting called
navTree: [ { text: "Home", selected: false, onClick: () => { console.log("Home clicked"); } }, { text: "Test 1", selected: false, onClick: () => { console.log("Test 1 clicked"); } }, { text: "Fun", selected: false, onClick: () => { console.log("Test 2 clicked"); } } ], title: "Ira A. Fulton Schools of Engineering", parentOrg: "School of Computing, Informatics, and Decisions Systems Engineering", parentOrgUrl: "https://engineering.asu.edu", loggedIn: false,
Links
FOR APPROVERS