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

docs(fix): Improve <source> element page for consistency and clarity #29946

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

dipikabh
Copy link
Contributor

Description

This PR aims to improve the <source> element documentation by making the following updates:

  • Refines the introductory paragraph in the "Attributes" section by adding the lead-in sentence, "In addition, the following attributes can be used with it." (This addition could potentially be added to the HTML reference page template.)
  • Aligns attribute descriptions by first explaining "what it is", followed by whether or not it is allowed.
  • Replaces the numbered list in srcset with a bulleted list.
  • Moves the last two paragraphs in the "Attributes" section to the "Usage notes" section for better placement.
  • Updates example headings to adopt a gerund form and to eliminate the redundant use of "example".
  • Updates link texts to guides to match the titles of those pages.
  • Replaces "user agent" with "browser" for consistency.

Motivation

To improve the readability and consistency

Additional details

Doc issue tracker: #29788

@dipikabh dipikabh requested a review from a team as a code owner October 31, 2023 19:34
@dipikabh dipikabh requested review from chrisdavidmills and removed request for a team October 31, 2023 19:34
@github-actions github-actions bot added the Content:HTML Hypertext Markup Language docs label Oct 31, 2023
Copy link
Contributor

github-actions bot commented Oct 31, 2023

Preview URLs

(comment last updated: 2023-11-07 15:25:17)

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

@dipikabh great work, nice one Dipika. This is much better. I've left you a few content suggestions.

files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
2. A width descriptor, which consists of a string containing a positive integer directly followed by `"w"`, such as `300w`. The default value, if missing, is the infinity.
3. A pixel density descriptor, that is a positive floating number directly followed by `"x"`. The default value, if missing, is `1x`.
- A URL for an image.
- An optional width descriptor—a positive integer directly followed by `"w"`, such as `300w`. If not specified, the value used by default is infinity.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- An optional width descriptor—a positive integer directly followed by `"w"`, such as `300w`. If not specified, the value used by default is infinity.
- An optional width descriptor—a positive integer directly followed by `"w"`, such as `300w`. If not specified, the value used by default is `infinity`.

Copy link
Contributor Author

@dipikabh dipikabh Nov 3, 2023

Choose a reason for hiding this comment

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

This suggestion led me to check the spec (should have checked earlier). I did not find a reference either in the source element page or in the linked srcset attribute page.

This section in the spec from "srcset attribute" does not mention any default values for the width and pixel density descriptors. I am not sure if we should mention them in our docs. What do you think?

  1. Zero or one of the following:

Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm, this is a good point. The default value descriptions aren't that helpful and probably confuse more than they inform. About the closest there is to a default value description in the spec is on the srcset page:

For the purpose of this requirement, an image candidate string with no descriptors is equivalent to an image candidate string with a 1x descriptor.

A bigger issue, in my mind, is that the text here doesn't really describe the purpose of srcset/sizes, or how you would use them.

I would suggest:

  1. Removing the default value descriptions, or perhaps just say something afterwards to the effect that, if a ...w or ...x is not included, it is equivalent to specifying 1x. I think that is what the spec is saying?
  2. Include some more description and usage examples on the page, or link to some somewhere else. I did attempt to provide this in my learning area Responsive Images article, but I don't know how bulletproof that actually is. It seems to make sense to me, but we've had quite a few tickets filed in the past querying whether the code is correct. It was challenging to figure this stuff out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for taking the time and for offering suggestions!

  1. Agree, removed the default value statement from each descriptor and added a common one in the subsequent para (c96683a).
  2. Should we tackle this outside this PR? :)

files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
files/en-us/web/html/element/source/index.md Outdated Show resolved Hide resolved
@dipikabh dipikabh mentioned this pull request Nov 3, 2023
8 tasks
@dipikabh
Copy link
Contributor Author

dipikabh commented Nov 3, 2023

Thanks a lot @chrisdavidmills for taking the time to review this PR. Great feedback, I've accepted your suggestions.
I could use your help with a question I've added here: #29946 (comment)

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

@dipikabh Thanks, this is looking nearly perfect now. There is just the question of what to do about the srcset description. I have provided some suggestions.

@dipikabh
Copy link
Contributor Author

dipikabh commented Nov 7, 2023

@chrisdavidmills, I've accepted your suggestion for the descriptor default values. Thanks!
Maybe we do a follow up PR to improve on srcset?

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

Sure thing @dipikabh, that sounds like a very sensible way to tackle this. Approving.

@dipikabh
Copy link
Contributor Author

dipikabh commented Nov 8, 2023

Thanks, @chrisdavidmills!

@dipikabh dipikabh merged commit 8681d02 into mdn:main Nov 8, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants