<!DOCTYPE html>
<html>
<!-- There was a bug that styles are unexpectedly shared regardless of required status difference. -->
<head>
<style>
:required:valid {
    color: red;
}
</style>
</head>
<body>
<input required value="required">
<input value="optional">
</body>
</html>
