adobe/react-spectrum

Tabs component, trigger onSelectionChange on hover

Open

#5 611 ouverte le 20 déc. 2023

Voir sur GitHub
 (5 commentaires) (1 réaction) (0 assignés)TypeScript (1 500 forks)auto 404
bughelp wanted

Métriques du dépôt

Stars
 (15 634 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

Provide a general summary of the issue here

This is the component i'm using:

<Tabs onSelectionChange={(key) => {
			alert(key);
		}}>
  <TabList aria-label="Input settings">
    <Tab id="mouse">Mouse Settings</Tab>
    <Tab id="keyboard">Keyboard Settings</Tab>
  </TabList>
  <TabPanel id="mouse">Mouse Settings</TabPanel>
  <TabPanel id="keyboard">Keyboard Settings</TabPanel>
</Tabs>

The problem is the alert is appearing every time i hover the selected tab

🤔 Expected Behavior?

onSelectionChange should be triggered only on change, not on hover

😯 Current Behavior

onSelectionChange triggers also on hover on current tab (it looks only while the tab is focused)

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/epic-bogdan-sjd6ky

Version

"react-aria-components": "^1.0.0",

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mac OS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Guide contributeur