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(fx112-css-ray): Create new page for ray() function #26266

Merged
merged 9 commits into from
Apr 21, 2023

Conversation

dipikabh
Copy link
Contributor

@dipikabh dipikabh commented Apr 18, 2023

The syntax for the ray() function (value in offset-path) has been updated in Fx112.

  • <ray-size> is now optional.
  • The default value of <ray-size> is closest-side.

Changes in this PR

  • Updates the ray() function description in the existing offset-path page, adds links to some shape pages

  • Adds a new page for the ray() function. The webref is not updated with the new syntax so I have not included a "Formal syntax" section. I've added the syntax to the "Syntax" section for now.

Spec: https://drafts.fxtf.org/motion/#ray-function
Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1820071

Support in browsers

  • Firefox: ray() is available behind the flag layout.css.motion-path-ray.enabled .
  • Chrome: some offset-path: ray() functionality is available with "Experimental Web Platform features" enabled but the syntax implementation is not in sync with the latest spec. The BCD table on offset-path page contains a row on ray() that indicates complete support, which is contrary to what I saw in testing.

Codepens

Codepens for the examples used in the doc can be found here (tested in Firefox behind the flag):
Example 1: https://codepen.io/dipikabh/pen/yLReQaZ
Example 2: https://codepen.io/dipikabh/pen/PoyNQdz

Caveat

The functionality is still undergoing discussions:

To Do

Related issues

Doc issue tracker: #25358

@dipikabh dipikabh requested a review from a team as a code owner April 18, 2023 01:31
@dipikabh dipikabh requested review from estelle and removed request for a team April 18, 2023 01:31
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Apr 18, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 18, 2023

Preview URLs

Flaws (1)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/CSS/ray
Title: ray()
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: css.types.ray
External URLs (1)

URL: /en-US/docs/Web/CSS/ray
Title: ray()

(comment last updated: 2023-04-20 03:57:06)

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

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

a few comments. looking good. still working on the review.

files/en-us/web/css/offset-path/index.md Show resolved Hide resolved
files/en-us/web/css/offset-path/index.md Outdated Show resolved Hide resolved

{{CSSRef}}

The **`ray()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) defines a line segment that begins from an [offset starting position](https://drafts.fxtf.org/motion/#offset-starting-position) and extends in the direction of the specified angle. The line segment is referred to as "ray". The length of a ray can be constrained by specifying a size.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The **`ray()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) defines a line segment that begins from an [offset starting position](https://drafts.fxtf.org/motion/#offset-starting-position) and extends in the direction of the specified angle. The line segment is referred to as "ray". The length of a ray can be constrained by specifying a size.
The **`ray()`** [CSS](/en-US/docs/Web/CSS) [function](/en-US/docs/Web/CSS/CSS_Functions) defines a line segment that begins from a starting position set by {{CSSXref("offset-position")}} and extending in the direction of the specified angle. The line segment is referred to as "ray". The length of a ray can be constrained by specifying a size and the keyword `contain`.

Copy link
Contributor Author

@dipikabh dipikabh Apr 20, 2023

Choose a reason for hiding this comment

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

I intentionally left out linking to offset-position page on MDN because the property is currently not supported on any browser (and therefore not used in any example) but the concept is supported in calculations. I took cue from the offset-position description that contains a link to spec's "initial position" definition to add a similar link here to a definition in the spec for the "offset starting position".

files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

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

made some suggestions. Also forked your codepens. The first example doesn't work for me without size.

files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Show resolved Hide resolved
files/en-us/web/css/ray/index.md Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
files/en-us/web/css/ray/index.md Outdated Show resolved Hide resolved
@dipikabh
Copy link
Contributor Author

Thanks for the review @estelle and for your help with fixing the code.

  1. I have fixed your comments except I wasn't able to move part of CSS in second example to "css hidden" (Firefox 112 with the flag layout.css.motion-path-ray.enabled):
  • In the first example, I put part of the CSS in "css hidden" like you suggested and the example works fine.
  • In the second example, when I put part of CSS code in "css hidden", the animation stopped working (while I could see the animation working in your codepen in the same browser, different tab). The animation started working after I removed "css hidden".
  1. I added closest-side to all cases in the first example because I could validate the "Note" text you've added. Just to make a record of the observations here:
  • specifying only the angle value is working in Firefox 112 behind the flag
  • specifying only the angle value is working in Chrome Canary with #enable-experimental-web-platform-features
  • not working in Chrome 112 with or without #enable-experimental-web-platform-features (in exp mode, first example works with explicit mention of closest-side, second example still not working)
  • second example is working in Safari TP, indicating that sides might be better supported than closest-side? offset-anchor does not work

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

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

Thanks! 🎉

@estelle estelle merged commit 93e045c into mdn:main Apr 21, 2023
@dipikabh dipikabh deleted the fx112-ray-function branch April 21, 2023 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants