Open
Description
Describe the bug
ButtonStyle configuration.isPressed not updated properly
To Reproduce
The demo code is enough to reproduce the bug
Button("Pressed Button Style") {
print("tapped")
}
.buttonStyle(
PressedButtonStyle(pressedColor: Color.red)
)
struct PressedButtonStyle: ButtonStyle {
let pressedColor: Color
func makeBody(configuration: Configuration) -> some View {
configuration.label
.foregroundColor(configuration.isPressed ? pressedColor : .blue)
.padding(15)
}
}
Steps to reproduce the behavior:
- Press button and keep it pressed
- Move away from the button while still pressing the button
- Release
- Observe that
.isPressed
is still set totrue
Expected behavior
.isPressed
set to false
and color change
Desktop (please complete the following information):
- OS: [macOS 13.3.1]
- Browser [chrome, safari]
- Version of the browser [112.0.5615.137 and 16.4]
- Version of Tokamak [0.11.0]