Skip to content

[java] Fix Unicode value for OPTION key in Keys enum #15966

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

iampopovich
Copy link
Contributor

@iampopovich iampopovich commented Jun 26, 2025

User description

🔗 Related Issues

fixes #15945 also fixes #15910

💥 What does this PR do?

Option key code fixed according to specification https://w3c.github.io/webdriver/#keyboard-actions

🔧 Implementation Notes

This pull request includes a small change to the Keys enum in the Keys.java file. The change updates the Unicode value for the OPTION key to align with the WebDriver specification.

🔄 Types of changes

  • Bug fix (backwards compatible)
  • New feature (non-breaking change which adds functionality and tests!)

PR Type

Bug fix


Description

  • Fix Unicode value for OPTION key in Keys enum

  • Update from '\uE050' to '\uE052' to align with WebDriver specification

  • Resolves macOS keyboard action compatibility issues


Changes walkthrough 📝

Relevant files
Bug fix
Keys.java
Fix OPTION key Unicode value                                                         

java/src/org/openqa/selenium/Keys.java

  • Changed OPTION key Unicode value from '\uE050' to '\uE052'
  • Updated to align with WebDriver specification for keyboard actions
  • +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added the C-java Java Bindings label Jun 26, 2025
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Duplicate Values

    The OPTION key now uses the same Unicode value '\uE052' as RIGHT_ALT, which could cause conflicts or unexpected behavior when both keys need to be distinguished in keyboard actions.

    RIGHT_ALT('\uE052'),
    RIGHT_COMMAND('\uE053'),
    
    // Symbolic macOS keys not yet standardized
    OPTION('\uE052'), // TODO: verify Unicode value with WebDriver spec
    TODO Comment

    The TODO comment suggests the Unicode value still needs verification with WebDriver spec, indicating this change might not be final or fully validated against the specification.

    OPTION('\uE052'), // TODO: verify Unicode value with WebDriver spec
    FN('\uE051'), // TODO: symbolic only; confirm or remove in future

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Avoid duplicate Unicode values

    The OPTION key now has the same Unicode value as RIGHT_ALT ('\uE052'), creating
    a duplicate mapping. This could cause ambiguity in key handling and unexpected
    behavior when both keys are used.

    java/src/org/openqa/selenium/Keys.java [122]

    -OPTION('\uE052'), // TODO: verify Unicode value with WebDriver spec
    +OPTION('\uE054'), // TODO: verify Unicode value with WebDriver spec
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies that the PR introduces a duplicate Unicode value. The new value for OPTION (\uE052) is the same as for RIGHT_ALT. This could lead to ambiguity or unexpected behavior, so flagging it is a valid and helpful observation.

    Medium
    • More

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    [🚀 Feature]: Add macOS-specific keys (OPTION, FN) to Keys enum
    2 participants