It's Not a Bug, It's a Feature... No, It Really Is. Microsoft vs. Linux

Posted: 2007-06-29 10:24:56

Make an HTML form with a text field and two submit buttons. Load Firefox and IE, bring the text field into view, and press the enter key.

When you have a form with one or more buttons, hitting enter under Firefox will POST the value of the 1st form button. On the other hand, with IE, unless a specific button was selected, no button values will POST.

At this point, I know a lot of people would start claiming that Microsoft is sloppy, IE is brain dead, Firefox is so much better, and more similar tripe… But think about it, how should the browser know which button is “first”? Should it be the 1st one in the HTML code? Should the “tabindex” value affect the situation? Could something be manipulating the button visibility or placement under CSS or JavaScript? Can the true human-interpreted layout even be determined by code?

And what about the question of whether the ‘enter’ key signifies “submit form”, or “submit form and the 1st button value”?

Windows has been deployed on hundreds of millions of systems, if not more. The user-base is very diverse: with different cultures, languages, and processes. If you want to cater to that user-base, you cannot make assumptions. IE is absolutely correct in not POSTing the value of an unselected form button on an ‘enter’ key press.

And this does not even touch on the fact that when you have 100s of millions of users, you also absolutely have to consider backward compatibility. Who knows how this used to work in the past, or what assumptions coders have made.

As is turns out, this really is a feature after all. And chances are, the rest of what the Linux fan-base complains about with Microsoft falls exactly along these lines. I’m all for GNU/Linux, just not mindless accusations and false claims.

submit.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>It's not a bug, it's a feature!</title>
</head>
<body>
<form action="submit.php" method="post" name="form" id="form">

<p><?php
if (isset($_POST['action'])) {
	if (isset($_POST['submit_1'])) echo $_POST['submit_1'] . '<br/>';
	if (isset($_POST['submit_2'])) echo $_POST['submit_2'] . '<br/>';
}
?></p>

<div>
	<input type="text" name="text" id="text" tabindex="1" value="" /><br/>

	<input type="submit" name="submit_1" id="submit_1" tabindex="2" value="Button 1 Clicked" />
	<input type="submit" name="submit_2" id="submit_2" tabindex="3" value="Button 2 Clicked" />

	<input type="hidden" name="action" value="submitted" />
</div>
</form>
</body>
</html>