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

Page titles should reflect usage: crypto.getRandomValues instead of Crypto: getRandomValues() #8977

Open
jakearchibald opened this issue Sep 16, 2021 · 7 comments
Labels
Content:WebAPI Web API docs MDN:Project Anything related to larger core projects on MDN needs decision The task needs consensus through discussion

Comments

@jakearchibald
Copy link
Contributor

jakearchibald commented Sep 16, 2021

A big step forward was made in #8351, but I'd like to propose this rule to page naming:

  1. If the item is available on the global, use the name. Eg:
  2. If the item is typically reached via properties reachable from the global, use that property chain, omitting the global.
  3. If the item is an instance method/property, use the constructor name with the first set of caps lower-cased + the property name.
  4. If the item is a static method/property, use the constructor name + the property name.
  5. Otherwise, just use the name.
@Elchi3
Copy link
Member

Elchi3 commented Sep 16, 2021

Thanks Jake!

You didn't mention what to do if the item is a static method/property. Luckily this (and more on titles) was discussed and answered here: https://github.com/mdn/content/discussions/5121#discussioncomment-785747

@jakearchibald
Copy link
Contributor Author

I've added a step for static methods/properties.

@Rumyra Rumyra added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Nov 25, 2021
@sideshowbarker sideshowbarker removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 19, 2022
@Josh-Cena
Copy link
Member

I believe this is already completed.

@jakearchibald
Copy link
Contributor Author

jakearchibald commented Jun 1, 2023

I still think this could be better.

For example: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues - it isn't until the example that you discover this can be called via self.crypto.getRandomValues.

The steps I provided in the OP would have titled this page crypto.getRandomValues, which is how you call this API.

@Josh-Cena
Copy link
Member

We now recommend large-scale suggestions to be tracked separately (because the traffic here is huge), so further improvements could be discussed within https://github.com/mdn/mdn-community or https://github.com/mdn/mdn.

Regardless, I'm ambivalent: while crypto.getRandomValues() is probably the only way developers can meaningfully interact with Crypto, is crypto actually meant to be a singleton? This question applies to all other interfaces that have a global instance.

@jakearchibald
Copy link
Contributor Author

further improvements could be discussed within https://github.com/mdn/mdn-community or https://github.com/mdn/mdn.

Which is best for this topic?

is crypto actually meant to be a singleton?

Yes. Where else do you see instances of Crypto?

This question applies to all other interfaces that have a global instance.

It doesn't. That's why I made the distinction in the OP "If the item is typically reached via properties reachable from the global"

https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues - Right now, if I wanted to find out how to use getRandomValues, MDN buries key information in the example, which is way down the page. Information of how to access the function shouldn't appear way after it's params, return value etc etc. It feels like developers are likely to land on this page because they want to know how to call this function. MDN doesn't currently cater well for this use-case.

https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register - Right now, if I wanted to find out how to register a service worker, MDN buries key information in the example, which is way down the page. Information of how to access the function shouldn't appear way after it's params, return value etc etc. It feels like developers are likely to land on this page because they want to know how to register a service worker. MDN doesn't currently cater well for this use-case.

https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined - Right now, if I wanted to find out when a custom element is defined, MDN buries key information in the middle of the second and final example, which is at the end of the content. Information of how to access the function shouldn't appear way after it's params, return value etc etc. It feels like developers are likely to land on this page because they want to know how tell when a custom element is defined. MDN doesn't currently cater well for this use-case.

As a counter-example, history.pushState states how to access the method early in the article https://developer.mozilla.org/en-US/docs/Web/API/History/pushState.

I can provide more examples if needed, but I'd hope that MDN aimed to hit these use-cases, and wouldn't be ambivalent to these kinds of failures.

@Josh-Cena
Copy link
Member

Okay, I'm going to reopen this. cc @mdn/yari-content-web-api for further discussions

@Josh-Cena Josh-Cena reopened this Aug 7, 2023
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Aug 7, 2023
@Josh-Cena Josh-Cena added Content:WebAPI Web API docs MDN:Project Anything related to larger core projects on MDN and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Aug 7, 2023
@Josh-Cena Josh-Cena changed the title Better naming of pages Page titles should reflect usage: crypto.getRandomValues instead of Crypto: getRandomValues() Jun 5, 2024
@Josh-Cena Josh-Cena added needs decision The task needs consensus through discussion and removed opportunity assessment labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs MDN:Project Anything related to larger core projects on MDN needs decision The task needs consensus through discussion
Projects
None yet
Development

No branches or pull requests

5 participants