react / react/react-strict-dom
Mobile only: Button is not pressable if I change color from `undefined` to value and back at `onPointerUp` event
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.6k
- Forks
- 206
- PR merge metrics
- No merged PRs in 30d
Description
Describe the issue
Our component manages button active style internally like on example below.
When onPointerUp callback is fired the style with the color property is removed from button element.
It somehow result in onClick callback not working.
https://github.com/user-attachments/assets/17810d7c-68ed-4d41-b16b-d3c739065c46
Expected behavior
onClick works as expected despite the change of styles
Steps to reproduce
RSD 0.0.47, the issue reproduces only on mobile.
const UnstyledButton = () => {
const [isActive, setActive] = React.useState(false);
return (
<h.button
style={isActive && styles.active}
type="button"
role="button"
onClick={() => alert('!')}
onPointerDown={() => setActive(true)}
onPointerUp={() => setActive(false)}
onPointerOut={() => setActive(false)}
onPointerCancel={() => setActive(false)}
onKeyDown={({ key }) => {
if (key === "Enter" || key === " " || key === "Space") {
setActive(true);
}
}}
onKeyUp={() => setActive(false)}
{...props}
>
Test Button
</h.button>
);
};
UnstyledButton.displayName = "UnstyledButton";
const styles = css.create({
active: {
color: '#0f0',
},
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided UnstyledButton example on mobile with RSD 0.0.47, focusing on the transition from the active color value back to undefined during onPointerUp. Trace the pointer-event and style-update path; done means onClick fires reliably after the active style is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100