【问题标题】:Why does material UI react stepper doesn't have tab focus?为什么material UI react stepper没有标签焦点?
【发布时间】:2020-06-12 18:49:09
【问题描述】:

material-UI react stepper 控制步骤不接收选项卡焦点。有没有办法在步骤上启用 tabFocus?

https://material-ui.com/components/steppers/

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    我已经看到 tabFocus 存在于台阶上,但没有显示样式。我想如果你添加 focusRipple props 属性

    <StepButton focusRipple onClick={handleStep(index)} completed={isStepComplete(index)} {...buttonProps}>
      {label}
    </StepButton>
    

    在 StepButton 组件上为 true,您可能会看到选项卡焦点 https://codesandbox.io/s/material-demo-4m4si

    【讨论】:

    • 我只是好奇为什么它默认不可用,因为 Stepbutton 来自 Buttonbase,它默认提供焦点波纹
    • 它在 ButtonBase 文档中可用,并且 ButtonBase 中的默认值也是 false,material-ui.com/api/button-base 正如你所说的 StepButton 是从 ButtonBase 派生的,默认情况下这里的值也是 false
    • 谢谢,我的意思是按钮默认有焦点涟漪,不需要我们明确地将其设置为 true。但是对于 stepbutton,只有在声明中将其设置为 true 时,焦点波纹才可见。
    猜你喜欢
    • 2021-01-20
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-08
    • 2017-03-12
    • 2020-03-20
    • 1970-01-01
    相关资源
    最近更新 更多