英文:
Remove focus and active effects from Bottom Sheet
问题
I want to remove the effects that occur when you click on the button and after clicking by default. In other words, when it's :focus and :active.
<button mat-raised-button click="openBottomSheet()" class="options-menu">
<mat-icon>more_vert</mat-icon>
</button>
I have removed the default styles with the box-shadow
, but I can't remove them in these two actions.
.options-menu {
box-shadow: none;
}
I also removed the box-shadow
in these two actions, but the background still remains grey.
.options-menu:focus:active {
background-color: transparent!important;
box-shadow: none!important;
}
I also tried this, but the grey background continues:
.options-menu .mat-mdc-button-persistent-ripple::before {
box-shadow: none!important;
background-color: transparent!important;
}
英文:
I want to remove the effects that occurs when you click on the button and after clicking by default. In other words, when its :focus and :active.
<button mat-raised-button click="openBottomSheet()" class="options-menu">
<mat-icon>more_vert</mat-icon>
</button>
I have removed the default styles with the box-shadow
but I can't remove in these two actions.
.options-menu {
box-shadow: none;
}
I remove the box-shadow
also in this two actions, but the background still being grey.
.options-menu:focus:active {
background-color: transparent!important;
box-shadow: none!important;
}
I also try this why, but the grey background continous:
.options-menu .mat-mdc-button-persistent-ripple::before {
box-shadow: none!important;
background-color: transparent!important;
}
答案1
得分: 2
你可以在按钮上使用[disableRipple]="true"
来移除点击效果。
<button mat-raised-button click="openBottomSheet()" class="options-menu" [disableRipple]="true">
<mat-icon>more_vert</mat-icon>
</button>
并且添加以下样式来移除点击阴影效果:
:host ::ng-deep .mat-raised-button:not(.mat-button-disabled):active:not([class*=mat-elevation-z]) {
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
// 使用 'none' 来移除阴影
}
英文:
you can use [disableRipple]="true"
on the button to remove the click effect
<button mat-raised-button click="openBottomSheet()" class="options-menu" [disableRipple]="true">
<mat-icon>more_vert</mat-icon>
</button>
and add the below style to remove the click shadow effect:
:host ::ng-deep .mat-raised-button:not(.mat-button-disabled):active:not([class*=mat-elevation-z]) {
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
// box-shadow: none; to remove the shadow
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论