简体   繁体   English

禁用焦点框阴影启动自动完成组件

[英]disable on focus box shadow primeng autocomplete component

I'm using primeng autocomplete input我正在使用primeng自动完成输入

I would that when I focus on the input the blue glow effect get disabled.我希望当我专注于输入时,蓝色发光效果会被禁用。

在此处输入图像描述

Here's my html component这是我的 html 组件

 <p-autoComplete [(ngModel)]="text" [suggestions]="results" (completeMethod)="search($event)"
 emptyMessage={{noBorrowerResult}} 
 [minLength]="3"
 [size] = "40"
 field = "name"
 >
 <ng-template let-elm pTemplate="item">
    <div class="suggestion-item">{{elm.name}} ( ID: {{elm.code}} )</div>
 </ng-template>
 </p-autoComplete>

I have tried to change css according to the documentation我试图根据文档更改 ZC7A62​​8CBA22E28EB17B5F5C6AE2A266AZ

::ng-deep .ui-autocomplete {
    box-shadow: 0 !important;
} 

but that doesn't work.但这不起作用。

.ui-autocomplete:focus {
  outline-color: transparent;
  outline-style: none;
}

Will prevent this effect on Chrome and Safari将阻止这种对 Chrome 和 Safari 的影响

this will work on Chrome, Safari and Firefox这将适用于 Chrome、Safari 和 Firefox

.ui-autocomplete:focus, .ui-autocomplete::-moz-focus-inner {
    outline: 0;
    border: 0;
}

and add this meta tag to remove it from IE9并添加此meta标记以将其从IE9删除

<meta http-equiv="X-UA-Compatible" content="IE=9" />

more details : https://css-tricks.com/removing-the-dotted-outline/更多细节: https : //css-tricks.com/removing-the-dotted-outline/

So far this works for me到目前为止,这对我有用

::ng-deep.ui-inputtext:enabled:focus:not(.ui-state-error) {
  outline: 0 none !important;
  outline-offset: 0 !important;
  box-shadow: 0 0 0 0 !important; /*I remove the border shadow*/
  border-color: black !important; /*Can change to any color*/
}

Write below code in CSS file, but it will apply for all input in that page.在 CSS 文件中写入以下代码,但它将应用于该页面中的所有输入。

:host >>> .p-inputtext:enabled:focus {
    border-color:#ced4da !important; //to avoid border color change
    box-shadow:none !important;
}
input:focus {
    box-shadow: none !important;
}

This css will eliminate the input glow on focus此 ZC7A62​​8CBA22E28EB17B5F5C6AE2A266AZ 将消除对焦时的输入辉光

在此处输入图像描述

Above image show that it has box-shadow on focus.上图显示它在焦点上有框阴影。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM