<p>The following button has <code>pointer-events:none</code>.</p>
<p>It may look disabled and the click event cannot be triggered with the mouse, but a user with a keyboard can focus on the button and trigger the click event with <kbd>Space</kbd> or <kbd>Enter</kbd>.</p>
<button>Button disabled with pointer-events</button>
<div id="log"></div>
div, p, button {
  font-family: arial, verdana, sans-serif;
  font-size: 1.125rem;
  line-height: 1.5rem;
  max-width: 45ch;

button {
  background: #ddd;
  border: 0;
  color: #888;
  outline-offset: 2px;
  padding: 0.5em 1em;
  pointer-events: none;

button:focus {
  outline: 1px dashed blue;

button:active {
  outline: 1px dashed red;

div {
  margin-top: 1rem;
let pressed = 0;

document.querySelector("button").addEventListener("click", function() {
  console.log("Button was pressed");
  document.querySelector("#log").innerHTML = `Button pressed ${pressed} times`;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.