• TechQA.

        Angular-material ng-click strange border highlight

        32.1k views Asked by Rus Paul At 2015-06-22T13:39:09+00:00 22 June 2015 at 13:39 2025-12-18T15:08:50+00:00

        I have a problem with using AngularJS and Angular-Material.

        Take a look at the following code:

        <div flex="100">
           <ul class="list-group">
               <li class="list-group-item cursorPointer" 
                ng-repeat="item in array" ng-click="selectItem(item)">
                  {{item.name}}
               </li>
            </ul>
        </div>
        

        The li tag has a ng-click function attach to it that contains some business logic. The problem is that there appears a strange border when you click on it (similar to user-selection highlight) and I can't seem to figure out where is it coming from.

        This seems to appear only when I have an ng-click directive on an element (same behavior on span element)

        Versions used:

        AngularJS - 1.4.1

        Angular-Material - 0.9.4

        Angular-Aria - 1.4.0

        Angular-Animate - 1.4.1

        Angular-UI-Boostrap - 0.9.0

        Bootstrap - 3.2.0

        JQuery - 2.1.4

        Any ideas? See this plnkr for example: http://plnkr.co/edit/60u8Ur?p=preview

        css angularjs angularjs-ng-click angular-material
        Original Q&A
        3

        There are 3 answers

        6
        ajmajmajma ajmajmajma On 2015-06-22T14:11:20+00:00 22 June 2015 at 14:11 BEST ANSWER

        Your problem is the :focus, you can get around by doing something like this

         span:focus {
            outline: none;
            border: 0;
         }
        

        So this is just for your span, you could get more specific on other items if you wanted to remove it elsewhere.

        0
        bhv bhv On 2017-03-29T04:52:53+00:00 29 March 2017 at 04:52

        this may be easy :

        add nofocus class to that elements,

        and add css to that class on :focus

        .nofocus:focus {
            outline: none;
        }
        
        0
        Amit Thakur Amit Thakur On 2018-02-13T07:02:16+00:00 13 February 2018 at 07:02

        I faced the same issue with most of the elements.

        In my case following CSS codes worked:

        *:focus {
            outline: none !important;
            border: 0 !important;
        }
        

        Related Questions in CSS

        • How to use custom font during html to pdf conversion?
        • Storing the preferred font-size in localStorage
        • mp4 embedded videos within github pages website not loading
        • Is there any way to glow this bulb image like a real light bulb
        • What can I do to improve my coding on both html and css
        • Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
        • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
        • How to increase quality of mathjax output?
        • Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
        • Storing selected language in localStorage
        • How to clip grid cell and provide scroll as well?
        • KeyboardAvoidingView makes a messy the flexbox
        • Rotate an object around another object in javascript
        • Understanding Scroll Anchoring Behavoir
        • how to use only block layout in this css code?

        Related Questions in ANGULARJS

        • How to automatically change path in angular when scrolling
        • Error two clicks to be able to login Angular 16
        • Passing an array of objects through the $http.post method in angular JS does not work
        • Understanding how to apply Angular Signals from beginning on an existing service
        • provider duplicate while compiling a Cordova application for the Android platform
        • How can I use angularjs $parse service in Angular?
        • Width of custom headers in ag-grid (angular) doesn't match with column's width
        • Issues with Katex/ngx-markdown Rendering in Angular 16
        • How to make Angular SSR wait for async operations to finish that are initiated in ngOnInit?
        • I want to install @angular/google-maps npm Package in angular 16.2.12 but "npm install @angular/google-maps" this is not working/ tell me other query
        • Angular 17 standalone application integrate CKEditor 5 -- Error: window is not defined
        • Why is $scope >= 0 showing true in interpolation while empty in controller?
        • The XMLHttpRequest compatibility library was not found
        • Making Gantt Chart Column Labels More Readable
        • Pass key-value pairs of object as individual arguments to component in Angular

        Related Questions in ANGULARJS-NG-CLICK

        • Cannot assign value "undefined" to template variable "buttonName". Template variables are read-only. Angular/TypeScript
        • Angular click directive scroll to section of page within modal-dialog not working with dynamic content
        • Angular.js unable to change scope variable value just after a different function call
        • In an Angular.js controller's scope function code doesn't run below a $timeout statement inside
        • Capture Ng-click event from button inside the texteditor in text-angular
        • Python Selenium ng-click action
        • ng-click event not getting fired with ng-repeat in a table
        • show div depend on number of clicks using ng-show, ng-click, ng-init
        • Angular JS ng-click not being triggered, using multiple controllers
        • how to change color Buttons once it is selected? and if input question
        • ng-click and ng-init variable definition
        • AngularJS - Toggle object value boolean on button click
        • Click not working after html append using ajax in Kendo UI
        • Scroll to ngFor angular item by clicking on another
        • Rebind ng-click event

        Related Questions in ANGULAR-MATERIAL

        • When I navigate to the URL'http://localhost:4200/', it redirects me back
        • Angular 17 | Angular Material 17.3.1 Issue with styling Angular Material Menu component
        • How do I delete a white layer over dialog background in Angular?
        • Angular Material mat-form-field appearance="outline"
        • How to make two-way binding in mat-select work
        • inject() must be called from an injection context Angular Microapp module federation
        • Why my angular material css file not working?
        • How to reuse Angular material table in Angular 17?
        • Angular material icon don't displayed
        • How to get sorted data from mat-table of all pages?
        • Handle mat-radio-button form value accessor in Angular Material
        • How do I keep the same time input style in both firefox and chrome
        • How can I configure Angular Material drag and drop to allow dropping an element when the cursor is outside the drop zone
        • cdkAutosizeMinRows and cdkAutosizeMaxRows settings of CdkTextareaAutosize not working as expected
        • Text pushed upwards in inputefield Type Time with Angular V14.2.7

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
        • Privacy
        • Terms
        • Cookies
        • Homegardensmart
        • Math
        • Aftereffectstemplates