Skip to content

Add can-lock-orientation CSS media feature#273

Open
marcoscaceres wants to merge 6 commits intogh-pagesfrom
add-css-media-feature-206
Open

Add can-lock-orientation CSS media feature#273
marcoscaceres wants to merge 6 commits intogh-pagesfrom
add-css-media-feature-206

Conversation

@marcoscaceres
Copy link
Member

@marcoscaceres marcoscaceres commented Oct 17, 2025

Closes #206

The following tasks have been completed:

  • Modified Web platform tests (link to pull request)

Implementation commitment:


Preview | Diff

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new CSS media feature can-lock-orientation that enables feature detection for screen orientation locking capabilities. The addition allows developers to conditionally style or display UI elements based on whether orientation locking is available in the current context.

  • Adds can-lock-orientation media feature with none and auto values
  • Includes privacy considerations to prevent fingerprinting through user preferences
  • Updates the abstract to reflect the new CSS integration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Implement can-lock-orientation media feature for Issue #206
- Add privacy considerations to prevent fingerprinting through user preferences
- Include examples showing CSS and JavaScript usage
- Update abstract to mention CSS media features

Fixes #206
@marcoscaceres marcoscaceres force-pushed the add-css-media-feature-206 branch from ea01973 to b76a334 Compare October 17, 2025 07:33
@marcoscaceres marcoscaceres requested a review from Copilot October 28, 2025 07:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcoscaceres marcoscaceres requested a review from Copilot October 28, 2025 08:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcoscaceres marcoscaceres requested a review from Copilot October 28, 2025 09:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@emilio
Copy link

emilio commented Nov 11, 2025

Why is this a media feature out of curiosity? Feels rather odd, is there any precedent for these can-*?

@marcoscaceres
Copy link
Member Author

@emilio, it's where we landed with:
#206

But yes, the name is terrible.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

multiple screen orientations, working alongside CSS.
The API restricts locking the screen orientation
only if certain [=pre-lock conditions=] are met.
This API particularly useful for applications such as
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

Missing word "is" before "particularly useful". Should be "This API is particularly useful for applications..."

Suggested change
This API particularly useful for applications such as
This API is particularly useful for applications such as

Copilot uses AI. Check for mistakes.
Comment on lines +925 to +929
<p>
The <a>can-lock-orientation</a> media feature can be used to test
whether the user agent supports screen orientation locking
functionality.
</p>
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

[nitpick] These lines appear redundant with the initial description at lines 917-921. The description "The can-lock-orientation media feature can be used to test whether the user agent supports screen orientation locking functionality" repeats the same information as "used to query whether the user agent supports locking the screen orientation in the current context." Consider removing this paragraph to avoid redundancy.

Suggested change
<p>
The <a>can-lock-orientation</a> media feature can be used to test
whether the user agent supports screen orientation locking
functionality.
</p>

Copilot uses AI. Check for mistakes.
<ul>
<li>The user agent does not implement the Screen Orientation API
</li>
<li>The document is not [=Document/fully active=]
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The condition "The document is not [=Document/fully active=]" is less specific than the actual check performed by the API. According to the common safety checks (line 487-490), the API checks if the document is a "fully active descendant of a top-level traversable with user attention", not just "fully active". Consider updating this to match the actual API requirement to ensure consistency and accuracy.

Suggested change
<li>The document is not [=Document/fully active=]
<li>The document is not a [=Document/fully active=] descendant of a top-level traversable with user attention

Copilot uses AI. Check for mistakes.
This API particularly useful for applications such as
computer games, where users physically rotate the device, but the
screen orientation itself should not change. The specification also
defines CSS media features to enable feature detection of orientation
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

[nitpick] The text uses the plural "CSS media features" but only one media feature (can-lock-orientation) is being defined in this specification. Consider using the singular "CSS media feature" for accuracy, or if multiple features are planned, this is fine as is.

Suggested change
defines CSS media features to enable feature detection of orientation
defines a CSS media feature to enable feature detection of orientation

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add can-lock-orientation media feature to detect if locking is possible

2 participants