Skip to content

Commit

Permalink
Fix bug where empty string is a valid focusKey
Browse files Browse the repository at this point in the history
  • Loading branch information
vovacodes committed Sep 2, 2021
1 parent 12255c9 commit a1cb76e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/demo/src/apps/SettingsMenu/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react"
import { useState } from "react"
import { motion } from "framer-motion"
import { Direction, Focusable, SyntheticGamepadKeyEvent } from "react-sunbeam"
import { Direction, Focusable } from "react-sunbeam"
import { Colors, Typography } from "../../styles.js"
import { isCancel, isLeft, isRight, isSelect } from "../../keyPressUtils.js"

Expand Down
2 changes: 1 addition & 1 deletion packages/react-sunbeam/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-sunbeam",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "Spatial navigation and focus management for React",
"keywords": [
"spatial-navigation",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sunbeam/src/focus/FocusableNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class FocusableNode implements IFocusableNode {
customGetPreferredChild?: CustomGetPreferredChildFn
lock: Direction[] | Direction | undefined
}) {
focusKey = focusKey ?? `focusable:${randomId()}`
focusKey = focusKey || `focusable:${randomId()}`
this.focusKey = focusKey
this.path = [...parentPath, focusKey]
this.getBoundingBox = getBoundingBox
Expand Down

0 comments on commit a1cb76e

Please sign in to comment.