Link or button

Three actions, each built three ways. The real ones are plain HTML; the fakes are a span or div with a click handler.

The controls

ActionReal linkReal buttonFake
Go to another page Open the help pagethe right element
a form with no fields
Open the help pagea span that sets location
Jump to a part of this page Jump to the resultsthe right element No plain-HTML waya button needs script to scroll Jump to the resultsa span that calls scrollIntoView()
Show a note Show the notea fragment link and :target the right element: popovertarget
Show the note
a div that toggles hidden

The button's note, a popover. Press Escape or click outside it to close it. The address did not change.

What to try on each control

  1. Click this page once, then press Tab repeatedly. Which controls receive focus, and which are skipped?
  2. On each control that has focus, press Enter. Then reload and try Space instead.
  3. Middle-click each control, or Ctrl-click (Cmd-click on a Mac). Which ones open a new tab?
  4. Right-click each control. Which ones offer "Copy link address" or "Open in new tab"?
  5. With a screen reader running, list the links and the buttons on this page. Which controls appear in neither list?

The results

What Chrome, Firefox and Safari do on a desktop. "Yes" means the browser provides it with no script.

ControlTab reaches itEnterSpaceMiddle-click, copy linkAnnounced as
Real linkYesYesNo: scrolls the pageYeslink
Real buttonYesYesYesNobutton
Fake span or divNoNoNoNoplain text

The fakes work for exactly one person: someone using a mouse, clicking with the main button, who never wants a second tab. Each "No" in the last row is a feature the fake's author would have to build by hand.