Skip to content

Add discouraged to schema (and with statement demo feature) #2388

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

Merged
merged 12 commits into from
Dec 20, 2024

Conversation

ddbeck
Copy link
Collaborator

@ddbeck ddbeck commented Dec 3, 2024

This adds discouraged to the schema. The idea here is that consumers would be able to show something like an MDN deprecation banner, saying that a feature is discouraged from use (citing a source) and suggesting an alternative (if one exists).

There are a couple of things missing here:

  • There is no documentation. I'd like to get some feedback on the overall approach here before writing up how consumers are meant to use this or how feature authors are to decide whether to set discouraged and set useful according_to and alternative values.
  • This depends on Add Destructuring feature #2386 as a valid alternative feature.

Someday, I'd like to have a proper status (with iconography) for this condition that would take the place of Baseline for such features. This is a prerequisite for doing this, but doesn't actually affect the Baseline definition today.

See also: #311

@github-actions github-actions bot added feature definition Creating or defining new features or groups of features. tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings labels Dec 3, 2024
@ddbeck ddbeck added the minor version required This PR requires a minor version semver release (vX.Y+1.0) label Dec 3, 2024
Comment on lines +5 to +13
baseline: false
support:
chrome: "38"
chrome_android: "38"
edge: "12"
firefox: "48"
firefox_android: "48"
safari: "10"
safari_ios: "10"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Given the current Baseline definition, this is correct. That said, I expect consumers (like MDN and caniuse) to choose to suppress the Baseline information when there's a discouragement.

Comment on lines 60 to 83
"discouraged": {
"additionalProperties": false,
"description": "Whether developers are formally discouraged from using this feature",
"properties": {
"according_to": {
"description": "Links to a formal discouragement notice, such as specification text, intent-to-unship, etc.",
"items": {
"description": "URI",
"format": "uri",
"type": "string"
},
"type": "array"
},
"alternatives": {
"description": "IDs for features that substitute some or all of this feature's utility",
"items": {},
"type": "array"
}
},
"required": [
"according_to"
],
"type": "object"
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a semver minor event.

@jamesnw
Copy link
Collaborator

jamesnw commented Dec 3, 2024

To stress test this a bit, I went through the CSS keys that are deprecated and standard track. I'm thinking I'll create the following features:

Clip alternative: `clip-path`
  • "css.properties.clip"
  • "css.properties.clip.auto"
  • "css.types.shape"
  • "css.types.shape.rect"
Media Queries (deprecated) alternative: media-queries
  • "css.at-rules.media.device-aspect-ratio"
  • "css.at-rules.media.device-height"
  • "css.at-rules.media.device-width"
Writing mode (deprecated) alternative: writing-mode
  • "css.properties.writing-mode.lr"
  • "css.properties.writing-mode.lr-tb"
  • "css.properties.writing-mode.rl"
  • "css.properties.writing-mode.rl-tb"
  • "css.properties.writing-mode.tb"
  • "css.properties.writing-mode.tb-rl"
color-adjust alternative: print-color-adjust
  • "css.properties.color-adjust"
SVG (deprecated)
  • Existing keys in draft, plus css.properties.glyph-orientation-vertical which was missed.
IME Mode (no alternative)
  • "css.properties.ime-mode"
text-decoration-line :blink alternative: animations-css
  • "css.properties.text-decoration-line.blink"
word-break: break-word alternative: Use overflow-wrap: anywhere instead (note we only can link to overflow-wrap)
  • "css.properties.word-break.break-word"
overflow: overlay alternative: Use overflow: auto instead (note we can only link to overflow-shorthand)
  • "css.types.overflow.overlay"
# Overview

Note that the list isn't long (and makes me want to double check my query), but it does surface a question around alternatives-

What should we do when the alternative is just a single key within a larger feature? Can we mention the alternative in the description when possible?

Copy link
Contributor

@captainbrosset captainbrosset 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.
Just left one comment to help consumers.

My more important general comment is how do we ensure that this isn't used for things we don't agree with. Because this is not data we can really check, there isn't much, beside thorough reviewing, to ensure this isn't used incorrectly.

Not sure what incorrect usage there could be, but I want to avoid, for example, cases where someone marks a feature as discouraged because it's just not implemented in browser X, and browser X vendor opposes that feature.

Comment on lines 66 to 70
"items": {
"description": "URI",
"format": "uri",
"type": "string"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about making this an object with both URI and link text?

Having the URI only forces consumers to come up with some link text on their own (or display the full URI, which isn't great).
This would avoid patterns like: "Discouraged, click here to learn why".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is a good idea, but I'm slightly concerned about us making guesses about what kind of text that consumers would like. I could imagine several different plausible ways to turn discouragement citations into text (I had a try below). I think it might be better to see how MDN and others actually end up using this and what works with developers, before committing to a single way of doing link text.

I do think we should revisit this, like the reason enums.


Possible ways to show this stuff:

All are possible without a handwritten text field.

@atopal
Copy link
Collaborator

atopal commented Dec 4, 2024

I like this. Just left one comment to help consumers.

My more important general comment is how do we ensure that this isn't used for things we don't agree with. Because this is not data we can really check, there isn't much, beside thorough reviewing, to ensure this isn't used incorrectly.

Not sure what incorrect usage there could be, but I want to avoid, for example, cases where someone marks a feature as discouraged because it's just not implemented in browser X, and browser X vendor opposes that feature.

That is a concern for sure, and it's independent of the wording. Even going with "deprecated", unless that comes out of the standardization process, it's not clear what should happen next. If one vendor considers an API as deprecated, but another one doesn't. Is that feature deprecated? Not hypothetical either, see Battery Status.

@atopal
Copy link
Collaborator

atopal commented Dec 4, 2024

Maybe we limit this to cases where it's unambiguous (either from the spec or alignment of vendors) and explicitly exclude cases where there is disagreement for now?

Copy link
Collaborator

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

I've applied this to #2076 and it works for me. I think this could land and "reason" could be added later among other things.

Suppressing the baseline info should probably be strongly encouraged somehow, but I guess it is fine to expose false for now. Adding "discouraged" as a new baseline enum would certainly be more bold and maybe that would be the correct thing but maybe not now to avoid being too disruptive. I guess it would still be a possibility to change it later in a breaking release if desired.

@captainbrosset
Copy link
Contributor

This PR was discussed during today's WebDX CG call (minutes).

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 12, 2024
@ddbeck
Copy link
Collaborator Author

ddbeck commented Dec 12, 2024

I've pushed some guidelines and changes to the README for consumers. I hope it answers most of the remaining questions.

What should we do when the alternative is just a single key within a larger feature? Can we mention the alternative in the description when possible?

Eventually, I think we should have a way to refer to inner/sub-features, but I don't think we have to have it here. I suspect that after we've enumerated the discouraged features we can revisit this more easily.

For now, I think we can satisfy the basic case of "see also: [something else to use instead]" without providing a detailed explanation for what we're referring to, specifically.

Not sure what incorrect usage there could be, but I want to avoid, for example, cases where someone marks a feature as discouraged because it's just not implemented in browser X, and browser X vendor opposes that feature.

Maybe we limit this to cases where it's unambiguous (either from the spec or alignment of vendors) and explicitly exclude cases where there is disagreement for now?

I included some text covering this in the new guidelines. The main thrust of it is: only set discouraged when a feature has consensus for discouragement. In most cases, this will come affirmatively from the specification (text saying don't use it or a transparent decision to drop something from a specification). Less frequently, this could come from the implementers, if all of them did so (e.g., you have a single-browser feature and that vendor starts telling developers to stop using that feature).

@ddbeck ddbeck removed the request for review from foolip December 12, 2024 18:40
Mark a feature as discouraged when:

- The specification adopts clear language directing developers to stop using that feature or to prefer to an alternative.
This is often through terms like "deprecated", "obsolete", "legacy", or "non-standard."
Copy link
Contributor

Choose a reason for hiding this comment

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

I would omit the "non-standard" part here. There are many non-standard (yet) features that are not discouraged, per se.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I've removed this with fc94af6. I think it's true—particularly when a spec absorbs some but not all functionality from a non-standard predecessor—but it probably doesn't add clarity here (without more explanation).

@ddbeck
Copy link
Collaborator Author

ddbeck commented Dec 19, 2024

FYI: I'm planning to merge this PR after the last BCD and web-features releases of the year, probably the afternoon of Friday, December 20.

fiji-flo pushed a commit to mdn/rari that referenced this pull request Dec 19, 2024
* feat(baseline): hide banner if discouraged

web-platform-dx/web-features#2388

* cargo fmt
@ddbeck ddbeck enabled auto-merge (squash) December 20, 2024 16:41
@ddbeck ddbeck merged commit 4eb902c into web-platform-dx:main Dec 20, 2024
3 checks passed
@ddbeck ddbeck deleted the discouraged-data branch December 20, 2024 16:42
@ddbeck ddbeck removed the minor version required This PR requires a minor version semver release (vX.Y+1.0) label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature definition Creating or defining new features or groups of features. tools and infrastructure Project internal tooling, such as linters, GitHub Actions, or repo settings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants