8000 [rb] Add macOS key mappings for Options and Function keys by iampopovich · Pull Request #15959 · SeleniumHQ/selenium · GitHub
[go: up one dir, main page]

Skip to content

[rb] Add macOS key mappings for Options and Function keys #15959

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

Merged

Conversation

iampopovich
Copy link
Contributor
@iampopovich iampopovich commented Jun 25, 2025

User description

🔗 Related Issues

fixes #15945

💥 What does this PR do?

This pull request adds new key definitions to the Keys module in rb/lib/selenium/webdriver/common/keys.rb to improve support for macOS-specific keys.

Key additions:

  • Added options key definition ("\ue050") to represent the macOS Options key, which is equivalent to right_shift.
  • Added function key definition ("\ue051") to represent the macOS Function key, which is equivalent to right_control.

🔧 Implementation Notes

💡 Additional Considerations

🔄 Types of changes

  • New feature (non-breaking change which adds functionality)

PR Type

Enhancement


Description

  • Add macOS-specific key mappings for Options and Function keys

  • Map Options key to right_shift and Function key to right_control

  • Improve macOS keyboard support in Ruby bindings


Changes walkthrough 📝

Relevant files
Enhancement
keys.rb
Add macOS Options and Function key mappings                           

rb/lib/selenium/webdriver/common/keys.rb

  • Added options key mapping ("\ue050") as alias for right_shift
  • Added function key mapping ("\ue051") as alias for right_control
  • Enhanced macOS keyboard support with platform-specific key definitions
  • +2/-0     

    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-rb Ruby Bindings label Jun 25, 2025
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Key Mapping

    The mapping of macOS Options key to right_shift and Function key to right_control should be validated to ensure these are the correct WebDriver key codes for macOS keyboard interactions. Consider if these mappings align with actual macOS key behavior and WebDriver specifications.

    options: "\ue050", # macOS Options key, same as right_shift
    function: "\ue051", # macOS Function key, same as right_control

    Copy link
    Contributor
    qodo-merge-pro bot commented Jun 25, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix incorrect macOS key mapping
    Suggestion Impact:The suggestion was directly implemented - the Options key mapping was changed from \ue050 to \ue052 as suggested

    code diff:

    -        options: "\ue050", # macOS Options key, same as right_shift
    +        options: "\ue052",

    The key mappings appear incorrect for macOS. The Options key should map to
    Alt/Option functionality, not right_shift, and the Function key has its own
    distinct behavior that shouldn't be aliased to right_control.

    rb/lib/selenium/webdriver/common/keys.rb [98-99]

    -options: "\ue050", # macOS Options key, same as right_shift
    +options: "\ue052", # macOS Options key, same as right_alt
     function: "\ue051", # macOS Function key, same as right_control

    [Suggestion processed]

    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies that the macOS Options key is equivalent to the Alt key and should be mapped to right_alt (\ue052), not right_shift (\ue050). This is a valid and important correction to the key mapping logic.

    Medium
    • Update

    @aguspe
    Copy link
    Contributor
    aguspe commented Jun 28, 2025

    Thank you for your contribution @iampopovich !

    @aguspe aguspe merged commit f1c075c into SeleniumHQ:trunk Jun 28, 2025
    22 checks passed
    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
    3 participants
    0