Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events guideline: Single entry for event and onXXX event handler #13595

Merged
merged 4 commits into from
Nov 29, 2021

Conversation

Elchi3
Copy link
Member

@Elchi3 Elchi3 commented Nov 18, 2021

Summary

Update the data guideline on events to require a single BCD entry for an event. (no separate data for onXXX).

Related issues

https://github.com/mdn/content/discussions/9098

@github-actions github-actions bot added the docs Issues or pull requests regarding the documentation of this project. label Nov 18, 2021
@@ -56,13 +56,15 @@ For example, the feature for a `focus` event targeting the `Element` interface w
}
```

This rule applies to the event features themselves, not the features for the event handlers. For example, `focus_event` and `onfocus` are two separate features.
The event handler `onfocus` is included in the `focus_event` entry. If an implementation doesn't support the event handler property, use `partial_implementation`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you suggest what the note text should be?

Can you also say what should happen if onfocus is supported but the "focus" event cannot be fired? That can mess with feature detection, but I think we should probably still just not record it in BCD.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a note text

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice. Just a couple suggestions.

@@ -56,13 +56,16 @@ For example, the feature for a `focus` event targeting the `Element` interface w
}
```

This rule applies to the event features themselves, not the features for the event handlers. For example, `focus_event` and `onfocus` are two separate features.
The event handler `onfocus` is included in the `focus_event` entry. If an implementation doesn't support the event handler property, use `partial_implementation` with the note `"The <code>onfocus</code> event handler property is not supported."`. If an implementation doesn't support the event name, use `partial_implementation` with the note `"The <code>focus</code> event name is not supported."`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions here, for clarity:

  • I think it's worth including an explicit prohibition on creating on entries (i.e., having an imperative like "Don't create features for on event handler properties"). Perhaps saying "represented by" instead of "included in" would also help? As written, I think there's a plausible interpretation here that on handlers can be subfeatures of the event feature.
  • "If an implementation doesn't support the event name…" is slightly ambiguous. It could be read as if all events are either fully supported or partially supported and none are false. Perhaps something like "If only the handler is supported…"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the "If an implementation doesn't support the event name" case, I think we should treat that as not supported, meaning no "version_added": false. It is possible that on* properties exist and will mislead feature detection, but I don't think the value of trying to capture this correctly justifies the work.

Although I will say that one benefit of representing it is that if tests using the on* properties show earlier support than BCD, then such partial_implementation entries would avoid incorrectly updating BCD to claim earlier support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I addressed Daniels suggestions.

And I agree with Philip to make it "version_added": false when on* event handler exists but no event name.

Co-authored-by: Philip Jägenstedt <[email protected]>
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. I also agree with the idea to report handler-only support as false, mostly because it means there's one and only one test to go from false to truthy, and that's whether addEventListener works. The rest is just details.

@ddbeck ddbeck merged commit f3cf16c into mdn:main Nov 29, 2021
@ddbeck
Copy link
Collaborator

ddbeck commented Nov 29, 2021

@Elchi3 Hmm, should we do semver minor or major for this? Or would you like to avoid merging any of these until after tomorrow's release, to buy time to think about?

@Elchi3
Copy link
Member Author

Elchi3 commented Nov 29, 2021

The consequence of this is removals of and changes to existing (non-protected) data points. I guess I would lean towards semver minor if anything. What did we do when we last had a new data guideline or changed an existing one?

@Elchi3 Elchi3 deleted the events-guideline branch November 29, 2021 18:07
ddbeck added a commit to ddbeck/browser-compat-data that referenced this pull request Dec 1, 2021
ddbeck added a commit that referenced this pull request Dec 1, 2021
* Bump version to v4.0.13

* Populate intial notes

* Add release note (and semver minor) for #13595

* Fix heading levels

* Add stats

* Reduce clutter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issues or pull requests regarding the documentation of this project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants