-
Notifications
You must be signed in to change notification settings - Fork 2
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
GN-101 Issues #122
Merged
Merged
GN-101 Issues #122
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f20c88a
Scrim
emollett 78cbc72
GN-101 Move focus to search when clicked
emollett c9a3644
GN-101 Close MyAccount Dropdown on meganav click
emollett f3442d7
GN-101 Close MyAccount Dropdown on meganav click
emollett 473e161
Merge branch 'GN-101-Issues' of https://github.com/nice-digital/globa…
emollett 7a21c08
GN-95 Now click scrim to close
emollett 16ee7b5
Merge branch 'GN-95-Add-meganav-mechanism' into GN-95-With-scrim
emollett 7893635
GN-101 Fix list styling variation
emollett 01ee466
Merge branch 'GN-95-With-scrim' into GN-101-Issues
emollett 13e51aa
GN-101 Code review fixes
emollett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ export default class Account extends Component { | |
this.handleMyAccountButtonClick.bind(this); | ||
this.handleKeyDown = this.handleKeyDown.bind(this); | ||
this.handleMenuItemClick = this.handleMenuItemClick.bind(this); | ||
this.handleMegaMenuClick = this.handleMegaMenuClick.bind(this); | ||
} | ||
|
||
handleMyAccountButtonClick(e) { | ||
|
@@ -56,6 +57,19 @@ export default class Account extends Component { | |
} | ||
} | ||
|
||
// NOTE: We would benefit from managing the state higher up | ||
handleMegaMenuClick(event) { | ||
let megaMenu = document.querySelector("#header-menu"); | ||
|
||
if (megaMenu.contains(event.target)) { | ||
event.preventDefault(); | ||
this.setState({ | ||
isExpanded: false, | ||
}); | ||
megaMenu.focus(); | ||
} | ||
} | ||
|
||
handleMenuItemClick(e) { | ||
const href = e.currentTarget.getAttribute("href"); | ||
|
||
|
@@ -133,6 +147,8 @@ export default class Account extends Component { | |
}.bind(this) | ||
); | ||
} | ||
|
||
document.addEventListener("click", this.handleMegaMenuClick); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. generally in the react world, wherever you add an event listener, you need to remove it if the component unmounts. it's not necessarily always an issue, cos possibly the component doesn't ever unmount. i'm going to test something out with this. |
||
} | ||
|
||
render() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import '~@nice-digital/nds-core/scss/core'; | ||
|
||
.listUnstyled { | ||
@include nds-list; | ||
list-style: none !important; | ||
margin-left: 0; | ||
max-width: none; // To override max-width of 66ch set on lists | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not sure whether it's worth using a
ref
here rather than querying the dom directly.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.
maybe context?