Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hover state stuck on buttons after click

I have a form with two states: editing and visible. When you click an icon to edit the form two buttons (acting like submit) at the bottom appear to save or cancel. When I click them the form is updated (or cancelled) and the buttons disappear. The problem is when I re-open the form to edit it (and the buttons are visible again) the last one clicked still has it's hover state applied in Chrome.

       <div>
          <div class="col-xs-5">
            <button class="btn btn-primary pull-right" ng-click="save(true)">Save</button>
          </div>

          <div class="col-xs-5 cancel-btn">
            <button class="btn btn-primary pull-left" ng-click="cancel()">Cancel</button>
          </div>
        </div>

For simplicity here is just the cancel function...

   $scope.cancel = function() {
      //set a flag for angular to hide/show editing mode in HTML
      $scope.editMode = false;
   };
like image 411
user1876246 Avatar asked Jul 24 '14 14:07

user1876246


1 Answers

As mentionned in an earlier comment (runTarm), this is because of the active/focused state of the buttons.

To change it :

.btn-primary:active,
.btn-primary:focus {
  // place your 'default' styling over here
}

You will probably need to be more specific with your declaration because what I posted will override all the items with class btn-primary.

Hope this helps !

like image 63
eHx Avatar answered Oct 19 '22 22:10

eHx