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

Guidelines for short names #548

Open
foolip opened this issue Jan 29, 2024 · 18 comments
Open

Guidelines for short names #548

foolip opened this issue Jan 29, 2024 · 18 comments
Labels
consumer input wanted Feedback needed from consumers of web-features data documentation Improvements or additions to documentation

Comments

@foolip
Copy link
Collaborator

foolip commented Jan 29, 2024

Short names were added in #545 and @ddbeck suggested guidelines at #545 (comment).

@foolip
Copy link
Collaborator Author

foolip commented Jan 29, 2024

It's worth thinking more about sentence case vs. Capitalizing Every Word. #545 was merged with sentence case. I've sent #549 to show what would change if we capitalize.

These cases are not great with sentence case:

  • Cascade layers and Container queries, which I've seen capitalized many, many times.
  • Constraint validation API, where the trailing "API" makes it look more like a typo.
  • Web animations, which seems more generic and might cover CSS animations as well.

And these cases are not great when capitalized:

  • "Flexbox Gap", but we could make it "Flexbox gap"
  • "input Event", although that would be less strange as "input Event"
  • More generally, any name that ends with "attribute", "event", "method", "property" or similar, which we'll have more of in a future long name. Consider "CSS aspect-ratio Property", where aspect-ratio feels squashed in between those Big Words.

@tidoust also pointed out that https://github.com/w3c/browser-specs has a shortTitle property, and that capitalizes every word.

I'm still leaning towards keeping sentence case, but am not at all committed to it.

@tidoust
Copy link
Member

tidoust commented Jan 30, 2024

Regarding shortTitle property values in browser-specs, the W3C Manual of Style recommends to "Capitalize title words following U.S. usage". Most if not all specification titles follow that convention.

The same manual also lists some commonly misspelled terms with the example of "real-time communications", where capitalization depends on whether the term is used in titles and headings (and references to titles and headings) or to talk about the generic idea.

Applied to web-features, the rule of thumb could perhaps depend on whether the feature has a strong bond with a specification or a heading in a specification (e.g., "Container Queries" could perhaps be seen as strongly tied to the "Container Queries" section of the CSS Containment spec), or whether we're more talking about a generic idea, or a generic idea applied to something specific (e.g., "CSS aspect-ratio property" because property is a generic idea. Plus the spec actually uses lowercase in the heading for that ;))

@captainbrosset
Copy link
Contributor

captainbrosset commented Jan 30, 2024

I made some comments about the guidelines listed in #545 which, I'm realizing now, would make more sense in this issue here:

  • CSS: Let syntax and casing—such as : (for pseudos), @ (for at-rules), and kebab-case—do the talking (e.g., ":indeterminate" not ":indeterminate pseudo-class").

I'm on the fence about this one because I always think about beginners. It feels much more beginner-friendly, from my opinion, to say things like "has pseudo-element" rather than ":has", or "dialog html element" rather than "<dialog>".

Note that it could be a mix of both: ":has pseudo" and "<dialog> element". But, asking people to recognize a tiny syntax character to know what we're talking about feels like an unnecessary barrier to me.

  • HTML: Tags can stand in for the concept of an element (e.g., "<img>" not "<img> element" or "Image element").

What if we have an SVG element feature at some point. How would someone know if "<foo>" is SVG or HTML?

@foolip
Copy link
Collaborator Author

foolip commented Jan 30, 2024

@captainbrosset do you think a longName or structuredName would address the first concern? I'm imagining names like "CSS aspect-ratio property", "CSS :has() functional pseudo-class", or "HTML <dialog> element" for those.

For the <tagname> convention, I'd say that <tagname> means HTML, and we should prefix with SVG to disambiguate, like here:

@foolip
Copy link
Collaborator Author

foolip commented Feb 1, 2024

#565 is a case where I felt like "CSS translate, scale, and rotate properties" was the short possible name. Guidelines should at least allow for that, or ideally guide us in the same direction in the same situations going forward.

@captainbrosset
Copy link
Contributor

Sure, a long name would address my concern. But now I'm wondering if we need ID, shortName, and longName. Maybe just ID and longName?

@foolip
Copy link
Collaborator Author

foolip commented Feb 1, 2024

We might be able to get away with a single kind of name, I'm not sure. Right now there are no consumers for the names we've added, and probably a good next step is to talk to some people we think will show them...

caniuse.com is the main consumer I have in mind, so looping in @Fyrd here.

@ddbeck
Copy link
Collaborator

ddbeck commented Feb 2, 2024

Mentioning #291 so we can have a guideline for HTML attribute features, someday.

And editing to add: #321

@ddbeck ddbeck added the consumer input wanted Feedback needed from consumers of web-features data label Feb 15, 2024
@foolip
Copy link
Collaborator Author

foolip commented Feb 19, 2024

Copying what I wrote in #624 (comment):

We have no guidelines for when the name should look like code or not, but some precedent. So far we have these names with () in them:

  • :has()
  • :indeterminate()
  • :is()
  • :where()
  • Array at()
  • Array flat() and flatMap()
  • checkVisibility()
  • color-mix()
  • CSS abs() and sign()
  • CSS calc()
  • CSS calc() constants e, pi, infinity, and NaN
  • CSS min(), max(), and clamp()
  • CSS pow(), sqrt(), hypot(), log(), exp()
  • CSS round(), mod(), and rem()
  • CSS sin(), cos(), tan(), asin(), acos(), atan(), and atan2()
  • image-set()
  • input.showPicker()
  • scrollIntoView()
  • select.showPicker()
  • structuredClone()

Roughly, my thinking has been that when adding () or other small pieces of syntax hints towards what kind of thing it is, then do it even though it's not minimal. My thought has been that we'll eventually mark up names with <code> and have names like this:

  • :has()
  • Array flat() and flatMap()
  • CSS abs() and sign()
  • input.showPicker()
  • structuredClone()

I think this has very little downside in the cases of global/static things like :has() or structuredClone().

For instance methods (stuff on prototypes) it's a little bit inconsistent, already. I think we should favor short names, and for Array the style works.

For HTML elements it's a bit awkward and I'm not sure the choices so far will stand, but the alternatives to input.showPicker() that I've considered are worse IMHO:

  • HTMLInputElement.prototype.showPicker() (much worse)
  • HTMLInputElement showPicker()
  • <input> showPicker()

@foolip
Copy link
Collaborator Author

foolip commented Mar 7, 2024

@ddbeck had some very useful thoughts and feedback in #655 (comment). Noting that here since I'll merge the PR, to not lose the discussion.

@foolip
Copy link
Collaborator Author

foolip commented Mar 15, 2024

What to do about the Web prefix has come up in #691, so I'll write down my thoughts here. Our guideline is "Avoid frequently-used abbreviations and nouns, such as API and Web", but I had to use the example "web workers" as one of the few "obvious" cases, and I don't think we can always omit Web.

Based on MDN and what's in WPT, here's a fairly comprehensive list of what the specs call themselves:

A few more phrases that aren't the names of specs:

  • Web Components: refers to Shadow DOM, Custom Elements, etc.
  • Web Messaging: refers to postMessage() etc.
  • Web Notifications: refers to Notifications API
  • Web Storage: refers to localStorage and sessionStorage
  • Web Workers: refers (arguably) to the kinds of workers defined by HTML, but not service workers

@captainbrosset
Copy link
Contributor

Also Web Bluetooth.

@captainbrosset
Copy link
Contributor

There's a visual difference in these names, which I'm not sure carries meaning.
Web Share (with a space) and WebGPU (no space).

@tidoust does that mean anything in W3C spec land?

@tidoust
Copy link
Member

tidoust commented Mar 15, 2024

@tidoust does that mean anything in W3C spec land?

No. The title gets reviewed when a spec enters the Recommendation track, and sometimes changed to better align with the naming used in other specs, but that's done on an ad-hoc basis, and without a clear set of rules.

The Manual of Style has a minimal set of guidelines on the title, essentially "Capitalize title words following U.S. usage". To my knowledge, there has not been any attempt at harmonizing titles across specs (e.g., to add/remove "API", to use a "Web" prefix, or to use a space after "Web").

I also note the Naming principles in the TAG's Web Platform Design Principles document.

@foolip
Copy link
Collaborator Author

foolip commented Mar 15, 2024

Here are my opinions on all of this. Where I don't think we should include Web in the name / identifier:

  • Things from the HTML5 era: Web Messaging, Web Storage and Web Workers all have better names
  • Web Notifications is just notifications

I'm not too sure about these:

In all other cases I think Web should be included, for a few different reasons.

Because what comes after is a very generic word:

Because what comes after is a technology that also exists outside the web, and is sometimes a trademark:

Because Web is part of the name in syntax or API:

Because the name is well established:

@atopal
Copy link
Collaborator

atopal commented Mar 15, 2024

Your reasoning makes a lot of sense to me, but why the exception for something like notifications? It seems to me like that would be inline with "Because what comes after is a very generic word", which I think is a good reason to add the prefix.

@foolip
Copy link
Collaborator Author

foolip commented Mar 15, 2024

Mostly because the name of the spec is Notifications API. It must have been called Web Notifications by someone at some point, but that's not how I know the feature at least. Push is similar, sometimes called Web Push. I'd put these in the same category as the HTML5 era things, where the Web prefix didn't stick.

@ddbeck
Copy link
Collaborator

ddbeck commented Apr 4, 2024

The "should we omit API from names?" question came up on the WebDX call today. I'd like to partly unroll this. We have two broad (and overlapping) groups of features to contend with:

  1. Older features where can directly observe or ask web developers how they talk about those features (e.g., Stack Overflow, etc.).

  2. Newer features where there's less to go on from the audience of web developers.

In the former case, we collect some evidence and make a call. That feels easy-ish. If the term "API" is genuinely inseparable as used by developers, then we accept it. I suspect there aren't that many cases where web developers won't know what we're talking about if we don't use the term API, but that does mean that sometimes we'll have to use it.

In the latter case—if this project is generally successful—we have the possibility of choosing the name that web developers will see. That feels a little higher stakes. I suppose aesthetically I'd rather not canonize "API" in those cases. But also I worry that a real risk is getting an idiosyncratic name: one that came from a spec author or first person to blog about a feature, rather than several people thinking about or working with the feature. With that in mind, I think it's kinda nice to put the name to a discussion here in PR reviews—it's at least a nod toward the evolution that will play out amongst the broad group web developers over time.

@ddbeck ddbeck added the documentation Improvements or additions to documentation label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer input wanted Feedback needed from consumers of web-features data documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants