This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
Conversation
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
jeeyun
commented
Apr 16, 2020
jeeyun
commented
Apr 16, 2020
mathisscott
suggested changes
Apr 17, 2020
coryrylan
suggested changes
Apr 17, 2020
mathisscott
suggested changes
Apr 22, 2020
return; | ||
} | ||
|
||
if ($event.target && this.hostElement) { |
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.
Thoughts on this?
</div> | ||
<div class="clr-sr-only">${CommonStringsService.keys.modalContentEnd}</div> | ||
</div> | ||
<div class="modal-backdrop" aria-hidden="true"></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.
Thoughts here?
mathisscott
reviewed
Apr 22, 2020
coryrylan
suggested changes
Apr 22, 2020
Shijir
reviewed
Apr 23, 2020
coryrylan
reviewed
Apr 24, 2020
coryrylan
reviewed
Apr 28, 2020
return; | ||
} | ||
|
||
if ($event.target && this.hostElement) { |
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.
A function with lots of params can be a hint that a data structure is needed. You could apply this here:
interface FocusTrapElement extends HTMLElement {
topReboundElement: HTMLElement;
bottomReboundElement: HTMLElement;
}
export function focusElementIfInCurrentFocusTrapElement(focusedElement: HTMLElement, focusTrapElement: FocusTrapElement) {
if (FocusTrapTracker.getCurrent() === focusTrapElement && elementIsOutsideFocusTrapElement(focusedElement, focusTrapElement)) {
focusTrapElement.focus();
}
}
export function elementIsOutsideFocusTrapElement(focusedElement: HTMLElement, focusTrapElement: FocusTrapElement) {
return !focusTrapElement.contains(focusedElement) ||
focusedElement === focusTrapElement.topReboundElement ||
focusedElement === focusTrapElement.bottomReboundElement;
}
export class CdsBaseFocusTrap extends LitElement {
topReboundElement: HTMLElement;
bottomReboundElement: HTMLElement;
...
protected onFocusIn(event: FocusEvent) {
focusElementIfInCurrentFocusTrapElement(event.target as HTMLElement, this);
}
}
jeeyun
force-pushed
the
topic/core-modal
branch
from
April 29, 2020 17:21
09f518a
to
8963eef
Compare
mathisscott
approved these changes
Apr 30, 2020
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.
Just a couple of minor requests. Approving pre-emptively as neither are major issues.
coryrylan
approved these changes
Apr 30, 2020
jeeyun
force-pushed
the
topic/core-modal
branch
from
April 30, 2020 16:59
995f0b1
to
ff56cb8
Compare
Signed-off-by: Jeeyun Lim <jeeyun.lim@gmail.com>
jeeyun
force-pushed
the
topic/core-modal
branch
from
April 30, 2020 22:50
ff56cb8
to
e6d2957
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Signed-off-by: Jeeyun Lim jeeyun.lim@gmail.com
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #3953
What is the new behavior?
Does this PR introduce a breaking change?
Other information