Skip to content

fix(svg): render red stroke in <use> example#44696

Open
kirthi-b wants to merge 2 commits into
mdn:mainfrom
kirthi-b:fix/svg-example-circle-stroke
Open

fix(svg): render red stroke in <use> example#44696
kirthi-b wants to merge 2 commits into
mdn:mainfrom
kirthi-b:fix/svg-example-circle-stroke

Conversation

@kirthi-b

Copy link
Copy Markdown

Summary

Fixes #44640

The Example section on the <use> page says it draws "a circle with a different fill and stroke color," and the last copy sets stroke="red". But the referenced #myCircle already set stroke="blue", and a <use> copy cannot override a presentation attribute that the referenced element already defines, so the red was ignored and the circle rendered blue.

Change

Remove stroke="blue" from the referenced circle so the stroke="red" on the last copy renders, matching what the surrounding text describes. The attribute-override behavior is still explained in the Usage notes section, so nothing is lost.

The <use> example claimed to draw a circle with a different stroke color,
but the referenced circle already set stroke="blue", so the stroke="red"
on the last copy was ignored and rendered blue. Remove the stroke from the
referenced circle so the red stroke renders as the text describes. The
attribute-override behavior is still covered in the Usage notes section.

Fixes mdn#44640
@kirthi-b
kirthi-b requested a review from a team as a code owner July 12, 2026 23:57
@kirthi-b
kirthi-b requested review from chrisdavidmills and removed request for a team July 12, 2026 23:57
@github-actions github-actions Bot added Content:SVG SVG docs size/xs [PR only] 0-5 LoC changed labels Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

@chrisdavidmills chrisdavidmills left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @kirthi-b, and thank you for fixing this issue. I think your changes look fine — the example is now easier to understand, and the issue is fixed. I just had one comment for you to consider regarding improving the grammar in the example description.

@@ -43,7 +43,6 @@ This element implements the {{domxref("SVGUseElement")}} interface.
## Example

The following example shows how to use the `<use>` element to draw a circle with a different fill and stroke color.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
The following example shows how to use the `<use>` element to draw a circle with a different fill and stroke color.
The following example shows how to use the `<use>` element to draw multiple circles with different fill and stroke colors.

@github-actions github-actions Bot added size/s [PR only] 6-50 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:SVG SVG docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect circle stroke in Example

3 participants