Skip to content

Conversation

@pagour98
Copy link
Contributor

@pagour98 pagour98 commented Nov 28, 2024

Issue:

SPARK-564414

In case of accessibility, when we were over the Leave meeting button, the screen reader says "undefined, button"

Fix

  • Fixed code to include the text and as well as tooltip

Vidcast of testing:
https://app.vidcast.io/share/5a101376-0ffd-4881-bcd8-2d41c1e746c3

Manual Tests Performed

  • Checked accessibility with voice over and ensured it aligns with applause requirements.
  • Checked meeting behaviour and ensured we can join the meeting.
  • All voice over is exactly the same as before, the changes is only for "Leave meeting button"
  • I have tested mute/unmute and video on/video off and ensured it does not break any functionality in the Join Meeting button
  • After joining the meeting, I have also tested audio, video, share screen, settings & Leave meeting functionality.

Summary by CodeRabbit

  • New Features

    • Improved accessibility of the Webex Meeting Control by updating button labels for better screen reader support.
  • Bug Fixes

    • Ensured that the button label falls back to a tooltip if no text is provided, enhancing user experience.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2024

Walkthrough

The pull request modifies the WebexMeetingControl component, specifically the renderButton function within WebexMeetingControl.jsx. The update changes the ariaLabel property of the Button component to use text || tooltip, ensuring a fallback to tooltip if text is not provided. This adjustment aims to improve accessibility for screen readers by guaranteeing that an appropriate label is always available.

Changes

File Path Change Summary
src/components/WebexMeetingControl/WebexMeetingControl.jsx Updated ariaLabel in renderButton to use `text

Possibly related PRs

  • feat(meetings-widgets): fixed-join-meeting-acc #846: The changes in this PR also modify the ariaLabel property of the Button component in the WebexMeetingControl component, indicating a direct connection in the accessibility improvements made to the same function.

Suggested reviewers

  • Shreyas281299
  • sreenara

Poem

In the meeting's bright control,
A label now takes its role,
If text is lost, the tooltip's near,
For every ear, a voice to hear.
Accessibility, we cheer with glee,
A better world for you and me! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pagour98 pagour98 requested a review from adhmenon November 28, 2024 09:47
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
src/components/WebexMeetingControl/WebexMeetingControl.jsx (1)

Line range hint 38-75: Consider comprehensive accessibility improvements.

While this fix addresses the "Leave meeting" button, consider enhancing other accessibility aspects:

  1. The hint property is used for ariaLabel in the "asItem" case but not in the regular button case
  2. The pressed state for toggle buttons could benefit from an aria-pressed announcement

Consider this enhancement:

      <Button
        className={sc('control-button')}
        type={controlTypeToButtonType[type] || 'default'}
        size={48}
        isDisabled={isDisabled}
        onClick={action}
-       ariaLabel={text || tooltip}
+       ariaLabel={hint || text || tooltip}
        pressed={isActive && type === 'TOGGLE'}
+       aria-pressed={isActive && type === 'TOGGLE'}
        tooltip={tooltip}
        autoFocus={autoFocus}
        tabIndex={tabIndex}
      >
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d47a00d and eecfbfc.

📒 Files selected for processing (1)
  • src/components/WebexMeetingControl/WebexMeetingControl.jsx (1 hunks)
🔇 Additional comments (2)
src/components/WebexMeetingControl/WebexMeetingControl.jsx (2)

67-67: LGTM! Accessibility improvement for screen readers.

The change ensures that screen readers always have meaningful text to announce by falling back to the tooltip when text is not provided. This fixes the "undefined, button" announcement issue.


67-67: Verify edge case: both text and tooltip undefined.

While the change improves accessibility, let's verify that either text or tooltip is always defined for all control types to prevent potential "undefined" announcements.

✅ Verification successful

Both text and tooltip are safely handled in all cases

Looking at the complete component implementation, we can verify that:

  1. For regular buttons, if both text and tooltip are undefined, the button won't be rendered at all because the display object is checked first: if (!display || Object.keys(display).length === 0) { output = ''; }
  2. For item buttons, text is always rendered in the span element, so it must be provided by the adapter
  3. The ariaLabel fallback text || tooltip is safe because:
    • For regular buttons, at least one must exist for the button to be meaningful
    • For item buttons, a different fallback is used: hint || text
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for control definitions to verify text/tooltip presence
ast-grep --pattern 'display = {
  $$$
  text: $_,
  tooltip: $_,
  $$$
}'

# Search for direct Button usage with potential missing text/tooltip
ast-grep --pattern '<Button
  $$$
  text={$_}
  tooltip={$_}
  $$$
>'

Length of output: 147


Script:

#!/bin/bash
# Let's try a different approach to find control definitions and usages

# Search for text/tooltip prop definitions in the component
rg -U "text.*tooltip|tooltip.*text" src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Search for Button usages in the component
rg -U "<Button.*?>" -A 5 src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Check the control types and their properties
rg -U "const.*Control.*=.*{" -A 10 src/components/WebexMeetingControl/WebexMeetingControl.jsx

Length of output: 418


Script:

#!/bin/bash
# Let's fix the regex and try again

# Search for control definitions and their properties
rg -U "const.*Control.*=" -A 10 src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Look for Button component usage with more context
rg -U "<Button" -A 5 src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Search for text and tooltip prop assignments
rg "text[=:]|tooltip[=:]" src/components/WebexMeetingControl/WebexMeetingControl.jsx

Length of output: 663


Script:

#!/bin/bash
# Let's look for the props being passed to the component and how they're used

# Search for the component's prop definitions and destructuring
rg -U "WebexMeetingControl.*=.*{" -A 5 src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Look for where text and tooltip are defined/assigned
rg -U "(text|tooltip)\s*=\s*" -A 2 src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Check for default props or prop types if any
rg -U "(defaultProps|propTypes)" -A 5 src/components/WebexMeetingControl/WebexMeetingControl.jsx

Length of output: 960


Script:

#!/bin/bash
# Let's check the entire component file content to understand the full context

# Get the full component file content
cat src/components/WebexMeetingControl/WebexMeetingControl.jsx

# Also check for any test files that might show how the component is used
fd "WebexMeetingControl.test" --exec cat {}

Length of output: 5261

@pagour98 pagour98 requested a review from adhmenon November 29, 2024 07:03
Copy link
Contributor

@adhmenon adhmenon left a comment

Choose a reason for hiding this comment

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

Approving as of now, as it does make sense to use tooltip as a workaround, as it won't change.
However, as discussed offline, please do create a ticket in tech debt to investigate why the text & hint are coming as undefined. The issue needs to be checked separately.

@Shreyas281299
Copy link
Contributor

https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-587755 for further investigation

@pagour98 pagour98 merged commit 1cdf594 into webex:master Dec 3, 2024
7 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 3, 2024
## [1.276.1](v1.276.0...v1.276.1) (2024-12-03)

### Bug Fixes

* **fcc:** Leave meeting button accessibility issue. ([#847](#847)) ([1cdf594](1cdf594))
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.

3 participants