Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
FolderOrigin-RevId: /usr/local/google/home/meredithdodge/helltool/.
  • Loading branch information
Googler authored and mdodgelooker committed Apr 13, 2023
1 parent 7ece4e7 commit ec11d41
Show file tree
Hide file tree
Showing 1,782 changed files with 172,921 additions and 14,087 deletions.
4 changes: 2 additions & 2 deletions packages/components-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"main": "lib/main/index.js",
"module": "lib/module/index.js",
"types": "lib/index.d.ts",
"types": "src/index.ts",
"src": "src/index.ts",
"version": "1.0.3",
"sideEffects": false,
Expand All @@ -25,7 +25,7 @@
"prepublishOnly": "lk prepublishOnly"
},
"dependencies": {
"@looker/components": "4.1.1",
"@looker/components": "^4.1.3",
"@looker/sdk": "^22.4.2",
"@looker/sdk-rtl": "^21.3.3",
"@looker/visualizations-adapters": "^1.0.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/components-providers/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@looker/components-providers",
"license": "MIT",
"version": "1.5.30",
"version": "1.5.31",
"main": "lib/main/index.js",
"module": "lib/module/index.js",
"types": "lib/index.d.ts",
"types": "src/index.ts",
"src": "src/index.ts",
"sideEffects": false,
"publishConfig": {
Expand All @@ -24,7 +24,7 @@
"prepublishOnly": "lk prepublishOnly"
},
"dependencies": {
"@looker/design-tokens": "3.1.0",
"@looker/design-tokens": "^3.1.1",
"@looker/i18n": "1.0.0",
"i18next": "20.3.1",
"react-helmet-async": "^1.0.9",
Expand Down
21 changes: 7 additions & 14 deletions packages/components-providers/src/FocusTrap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ import { tabbable, isFocusable, isTabbable } from 'tabbable'
import type { Trap } from '../TrapStack/types'
import type { FocusTrapOptions } from './types'

// Firefox reverts focus to the body when using Select. activeElement keeps
// track of which element should maintain focus after selection
let activeElement: Element | null

// Evergreens support :focus-visible but JSDom still does not, so we must use
// this to check for support before using the selector.
const isFocusVisible = (element = document.activeElement) => {
Expand Down Expand Up @@ -87,8 +83,8 @@ export const activateFocusTrap = ({

const getInitialFocusNodeByPriority = () => {
// Return the already focused node within element
if (element.contains(activeElement as Node)) {
return activeElement
if (element.contains(document.activeElement as Node)) {
return document.activeElement
}

// Look for data-autofocus b/c React strips autofocus from dom
Expand Down Expand Up @@ -172,21 +168,18 @@ export const activateFocusTrap = ({
// This needs to be done on mousedown and touchstart instead of click
// so that it precedes the focus event.
const checkPointerDown = function (e: MouseEvent | TouchEvent) {
if (element.contains(e.target as Node)) {
activeElement = e.target as Element
} else if (options?.clickOutsideDeactivates) {
if (
!element.contains(e.target as Node) &&
options?.clickOutsideDeactivates
) {
deactivate()
}
}

// In case focus escapes the trap for some strange reason, pull it back in.
const checkFocusIn = (e: FocusEvent) => {
if (element.contains(e.target as Node)) {
activeElement = e.target as Element
return
}
// In Firefox when you Tab out of an iframe the Document is briefly focused.
if (e.target instanceof Document) {
if (element.contains(e.target as Node) || e.target instanceof Document) {
return
}
e.stopImmediatePropagation()
Expand Down
Loading

0 comments on commit ec11d41

Please sign in to comment.