The Principle of Least Surprise and the Web

| 2.97 kB

In short, The principle of least surprise proposes that every time a user does Action X they can expect Result Y.

Following that principle when developing for the web is easy. All you have to do is nothing. Yet many websites replace or remove native browser features. The result is a worse user experience.

Usually, when right-clicking on a website, it shows a little menu. Apps like Spotify and Tidal hijack that functionality and show a different menu.

After right-clicking again, most show the expected one. But features like Inspect break.

Another example would be opening links in a new tab. Every link should be openable in a new tab. That's how browsers and HTML works.

Let's look at YouTube. A search on YouTube navigates to a result page. But the search button isn't a link. Thus, it is not possible to open the results as a new tab.

Other concerns are a lack of the ability to select text, no scrollbar when the site is scrollable, and so on.

For a better User Experience, follow web standards. Don't try to replace the behavior of browsers. There's a reason why they do things. Follow the principle of least surprise.