Skip to content
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(navigation): corrige bugs de fermeture du composant [DS-3617, DS-3619] #840

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/component/navigation/script/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Navigation extends api.core.CollapsesGroup {
super.init();
this.clicked = false;
this.out = false;
this.listen('focusout', this.focusOutHandler.bind(this));
this.listen('click', this._clickHandling.bind(this));
zellerbaptiste marked this conversation as resolved.
Show resolved Hide resolved
this.addEmission(api.core.RootEmission.CLICK, this._clickOut.bind(this));
this.listen('mousedown', this.mouseDownHandler.bind(this));
this.listenClick({ capture: true });
}
Expand All @@ -26,14 +27,18 @@ class Navigation extends api.core.CollapsesGroup {
this.requestPosition();
}

clickHandler (e) {
if (e.target.matches('a, button') && !e.target.matches('[aria-controls]') && !e.target.matches(api.core.DisclosureSelector.PREVENT_CONCEAL)) this.index = -1;
_clickHandling (e) {
zellerbaptiste marked this conversation as resolved.
Show resolved Hide resolved
if (e.target.matches('a, button') && !e.target.matches('[aria-controls]') && !e.target.matches(api.core.DisclosureSelector.PREVENT_CONCEAL)) {
this.index = -1;
}
}

focusOutHandler (e) {
_clickOut (target) {
zellerbaptiste marked this conversation as resolved.
Show resolved Hide resolved
if (!this.isBreakpoint(api.core.Breakpoints.LG)) return;
this.out = true;
this.requestPosition();
if (!this.node.contains(target)) {
this.out = true;
this.requestPosition();
}
}

requestPosition () {
Expand Down