angular / angular/components

bug(Button): Button hover/clickable outside border & missing token

未关闭
#30,573 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/button P4
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### Is this a regression?

- [x] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

When a override is added to a button, the button remains clickable and can be hovered outside the border. I found a token to override this behavior, but I can't get it to work. Additionally, I suggest improving the documentation by specifying the types of values accepted for the token.

```
@include mat.button-overrides((
filled-touch-target-display: none
))
```

https://github.com/user-attachments/assets/11989574-c581-4aff-858b-d77e2368cd3e

Also there is no option to change outline color of outlined button when hovered/focused/pressed, only for disabled state? According to m3 design it should be possible:
https://m3.material.io/components/buttons/specs#4a0c06da-0b2f-47de-a583-97e0ae80b5a5

### Reproduction

StackBlitz link: https://stackblitz.com/edit/q9bg7z8v?file=src%2Fexample%2Fbutton-overview-example-override.scss
Steps to reproduce:
1. Try to move cursor close to the button border

### Expected Behavior

Button should not be clickable or able to hover outside button border

### Actual Behavior

Button is clickable and can be focused outside border

### Environment

- Angular: 19
- CDK/Material: 19.2.1
- Browser(s): Chrome, Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): macOS

贡献指南

打开贡献指南

调研方向

从 src/example/button-overview-example-override.scss 中的 StackBlitz 复现开始,检查 mat.button-overrides 如何处理 filled-touch-target-display。将 hover、focus 和 click 区域与可见边框进行比较,并验证 outlined-button 的交互颜色是否可配置;当命中区域与边框匹配且已记录接受的 token 值时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, sass, typescript
领域
frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。