adobe/react-spectrum

Tabs component, trigger onSelectionChange on hover

Open

#5.611 aberto em 20 de dez. de 2023

Ver no GitHub
 (5 comments) (1 reaction) (0 assignees)TypeScript (1.500 forks)auto 404
bughelp wanted

Métricas do repositório

Stars
 (15.634 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

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

Guia do colaborador