Skip to content

Commit

Permalink
WIP(ui-a11y-utils): check breaking test
Browse files Browse the repository at this point in the history
  • Loading branch information
balzss committed Dec 13, 2023
1 parent 981b334 commit 0c44f11
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/ui-a11y-utils/src/FocusRegion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FocusRegion {
private _listeners: ReturnType<typeof addEventListener>[] = []
private _active = false
private _documentClickTarget: Node | null = null
private _contextContainsTarget = false
// private _contextContainsTarget = false

constructor(element: Element | Node | null, options: FocusRegionOptions) {
this._options = options || {
Expand Down Expand Up @@ -82,20 +82,20 @@ class FocusRegion {
this._options.onDismiss?.(event, documentClick)
}

captureDocumentMousedown = (event: React.MouseEvent) => {
this._documentClickTarget = event.target as Node
this._contextContainsTarget = contains(
this._contextElement,
this._documentClickTarget
)
captureDocumentMousedown = (_event: React.MouseEvent) => {
// this._documentClickTarget = event.target as Node
// this._contextContainsTarget = contains(
// this._contextElement,
// this._documentClickTarget
// )
}

handleDocumentClick = (event: React.PointerEvent) => {
if (
this._options.shouldCloseOnDocumentClick &&
event.button === 0 &&
event.detail > 0 && // if event.detail is 0 then this is a keyboard and not a mouse press
!this._contextContainsTarget
!contains(this._contextElement, this._documentClickTarget)
) {
this.handleDismiss(event, true)
}
Expand Down Expand Up @@ -157,7 +157,7 @@ class FocusRegion {
)

this._listeners.push(
addEventListener(doc, 'click', this.handleDocumentClick)
addEventListener(doc, 'click', this.handleDocumentClick, true)
)

Array.from(doc.getElementsByTagName('iframe')).forEach((el) => {
Expand Down

0 comments on commit 0c44f11

Please sign in to comment.