Skip to content

Commit f09641e

Browse files
authored
Enable lint rule to encourage use of WB ResponsiveTabs/ResponsiveNavigationTabs (#3272)
## Summary: Wonder Blocks now has new ResponsiveTabs and ResponsiveNavigationTabs components that switches to a dropdown when there is limited space. In general, these components should be preferred for improved accessibility and responsiveness since it avoids 2 dimensional scrolling for users. For more details, check out the [release notes](https://khanacademy.atlassian.net/wiki/x/DoCGDwE)! To help encourage the use of these new components, we enable a lint rule that disables imports for the NavigationTabs and Tabs components. Currently, there is one instance of Tabs in Perseus for the keypad. Since this is rendered in a Popover, it is an exception since it is not ideal for the tabs to turn into a dropdown within a popover. Because of this, it is fine to leave the current `Tabs` usage as is, and the lint rule can be used for future use cases where the tabs pattern is needed. A similar lint rule was enabled in frontend in: Khan/frontend#8276 Issue: FEI-7513 ## Test plan: - Confirm a lint error is generated when Tabs or NavigationTabs is imported <img width="906" height="285" alt="Screenshot 2026-02-19 at 3 59 17 PM" src="https://github.com/user-attachments/assets/c730cdc9-198d-43c7-a7e3-4ce48f065f38" /> <img width="924" height="288" alt="Screenshot 2026-02-19 at 3 53 49 PM" src="https://github.com/user-attachments/assets/1bb6e8d8-c1df-4094-a65f-2b38e1206d8e" /> - Confirm lint continues to pass Author: beaesguerra Reviewers: beaesguerra, ivyolamit, #wonder-blocks Required Reviewers: Approved By: ivyolamit Checks: ⏭️ 1 check has been skipped, ✅ 10 checks were successful Pull Request URL: #3272
1 parent 299c87e commit f09641e

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

.changeset/great-lemons-joke.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.eslintrc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,19 @@ module.exports = {
306306
"Use seeded randomness. See: https://khanacademy.atlassian.net/browse/LEMS-3397",
307307
},
308308
],
309+
"no-restricted-imports": [
310+
"error",
311+
{
312+
paths: [
313+
{
314+
name: "@khanacademy/wonder-blocks-tabs",
315+
importNames: ["NavigationTabs", "Tabs"],
316+
message:
317+
"Use WB ResponsiveNavigationTabs or ResponsiveTabs for responsive behaviour. They render NavigationTabs or Tabs by default and switch to a dropdown when space is limited - test both layouts. See https://khan.github.io/wonder-blocks/?path=/docs/packages-tabs-overview--docs. \n\nIf responsiveness isn't needed, ignore this rule for that import.",
318+
},
319+
],
320+
},
321+
],
309322

310323
/**
311324
* monorepo

packages/math-input/src/components/keypad/keypad.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {View} from "@khanacademy/wonder-blocks-core";
22
import IconButton from "@khanacademy/wonder-blocks-icon-button";
3+
// eslint-disable-next-line no-restricted-imports -- Intentionally using Tabs instead of ResponsiveTabs to avoid rendering a dropdown within a Popover
34
import {Tabs} from "@khanacademy/wonder-blocks-tabs";
45
import {border, semanticColor, sizing} from "@khanacademy/wonder-blocks-tokens";
56
import xBold from "@phosphor-icons/core/bold/x-bold.svg";

packages/math-input/src/full-keypad.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
docs: {
2020
description: {
2121
component:
22-
"A customizable virtual keyboard for mathematical input that provides different key layouts for various math concepts.",
22+
"A customizable virtual keyboard for mathematical input that provides different key layouts for various math concepts. \n\n Note: This intentionally uses the WB Tabs component (instead of ResponsiveTabs) to avoid rendering a dropdown within a Popover.",
2323
},
2424
},
2525
},

0 commit comments

Comments
 (0)