Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Update changelog and typscript children as type
Browse files Browse the repository at this point in the history
  • Loading branch information
nickoola committed Apr 21, 2020
1 parent eab54b0 commit ca5e5cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- **[FIX]** Add a maximum width on `QrCard`
- **[FIX]** Fix the `font-size` and `line-height` of `TextBody`, `TextSubHeader` and `TextTitle` components.
- **[NEW]** Add `FocusVisibleProvider` and `useFocusVisible` utils to polyfill :focus-visible css pseudo class.
- [...]

# v29.0.0 (20/04/2020)
Expand Down
12 changes: 5 additions & 7 deletions src/_utils/focusVisible/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useEffect, useState, ReactNode } from 'react'
import React, { PropsWithChildren, createContext, useEffect, useState } from 'react'

import {
KEYS_TRIGGERING_KEYBOARD_NAVIGATION,
Expand All @@ -7,10 +7,6 @@ import {

// A React hook based on: https://github.com/WICG/focus-visible

interface FocusVisibleProviderProps {
children: ReactNode
}

const pointerMoveEventList = [
'mousedown',
'mouseup',
Expand All @@ -26,7 +22,7 @@ const pointerDownEventList = ['mousedown', 'pointerdown', 'touchstart']

export const FocusVisibleContext = createContext(false)

export const FocusVisibleProvider = ({ children }: FocusVisibleProviderProps) => {
export const FocusVisibleProvider = (props: PropsWithChildren<{}>) => {
/* When the provider first loads, assume the user is in pointer modality. */
const [hadKeyboardEvent, setHadKeyboardEvent] = useState(false)

Expand Down Expand Up @@ -102,7 +98,9 @@ export const FocusVisibleProvider = ({ children }: FocusVisibleProviderProps) =>
}, [])

return (
<FocusVisibleContext.Provider value={hadKeyboardEvent}>{children}</FocusVisibleContext.Provider>
<FocusVisibleContext.Provider value={hadKeyboardEvent}>
{props.children}
</FocusVisibleContext.Provider>
)
}

Expand Down

0 comments on commit ca5e5cf

Please sign in to comment.