From 5de483386693884ccdef22b9740582e6098a5baa Mon Sep 17 00:00:00 2001 From: Cat Johnson <123020281+catandthemachines@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:59:18 -0700 Subject: [PATCH] [Expression Remediation] Create arrow key navigation for TabBar component. (#1384) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary: Updating TabBar and TabbarItem component to support arrow key navigation. Included in this PR - The creation of arrow key navigation for Tabbar and specifically the TabItems used for changing the presenting panel. - Implementation of functionality for tab bar items, specifically the focus property and ability to change the role type. Issue: https://khanacademy.atlassian.net/browse/LEMS-2130 ## Test plan: Storybook - http://localhost:6006/?path=/story/math-input-full-keypad--everything-minus-navigation-pad - Confirm that tabbing goes through only the selected tabitem, and to select another tab a user must use their left and right arrow keys. Author: catandthemachines Reviewers: catandthemachines, handeyeco, mark-fitzgerald, anakaren-rojas Required Reviewers: Approved By: mark-fitzgerald Checks: ⌛ Upload Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: https://github.com/Khan/perseus/pull/1384 --- .changeset/polite-snails-know.md | 5 + .../__snapshots__/keypad.test.tsx.snap | 14 +- .../__snapshots__/mobile-keypad.test.tsx.snap | 8 +- .../keypad/__tests__/keypad.test.tsx | 4 +- .../keypad/__tests__/mobile-keypad.test.tsx | 2 +- .../src/components/keypad/keypad.tsx | 1 - .../components/tabbar/__tests__/item.test.tsx | 82 +++++++++++ .../tabbar/__tests__/tabbar.test.tsx | 8 +- .../math-input/src/components/tabbar/item.tsx | 127 +++++++++++------- .../src/components/tabbar/tabbar.tsx | 62 ++++++--- .../components/__tests__/math-input.test.tsx | 2 - .../__tests__/expression-mobile.test.tsx | 2 +- 12 files changed, 231 insertions(+), 86 deletions(-) create mode 100644 .changeset/polite-snails-know.md create mode 100644 packages/math-input/src/components/tabbar/__tests__/item.test.tsx diff --git a/.changeset/polite-snails-know.md b/.changeset/polite-snails-know.md new file mode 100644 index 0000000000..4817ab23ed --- /dev/null +++ b/.changeset/polite-snails-know.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/math-input": minor +--- + +Updating TabBar experience in to use arrow-key navigation to access the other TabItems. This will ensure the Expression Widget in perseus has proper keyboard navigation for users. diff --git a/packages/math-input/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap b/packages/math-input/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap index f261ded6fa..bcb11f03e6 100644 --- a/packages/math-input/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap +++ b/packages/math-input/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap @@ -10,10 +10,10 @@ exports[`keypad should snapshot expanded: first render 1`] = ` >