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

修复ChatGPTNextWeb页面的无障碍问题 #5219

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

mayfwl
Copy link
Contributor

@mayfwl mayfwl commented Aug 7, 2024

💻 变更类型 | Change Type

  • feat
  • fix
  • refactor
  • perf
  • style
  • test
  • docs
  • ci
  • chore
  • build

🔀 变更说明 | Description of Change

📝 补充信息 | Additional Information

#5079

Summary by CodeRabbit

  • New Features

    • Enhanced accessibility for the IconButton components, improving screen reader support with new ARIA attributes.
    • Added localization support for the FullScreen action and ShowPassword option in both Chinese and English, enhancing the user experience for speakers of those languages.
    • Introduced new ARIA attributes to various input components, improving usability for individuals relying on assistive technologies.
  • Bug Fixes

    • Improved clarity and usability of the chat interface through updated title and ARIA attributes for various buttons.

Copy link

vercel bot commented Aug 7, 2024

@mayfwl is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

Recent changes enhance accessibility across various components by incorporating ARIA attributes and improving localized support for assistive technologies. The IconButton component now allows for descriptive labels, while localization updates for Chinese and English expand usability for diverse users. These modifications collectively create a more navigable and inclusive application experience, ensuring that all users can interact with the components effectively.

Changes

Files Change Summary
app/components/button.tsx, app/components/chat.tsx, app/components/sidebar.tsx, app/components/sd/sd.tsx Added aria attributes to IconButton components for improved accessibility and screen reader support.
app/components/input-range.tsx, app/components/model-config.tsx, app/components/sd/sd-panel.tsx Introduced aria labels for various input elements to enhance semantic structure and accessibility.
app/components/mask.tsx, app/components/settings.tsx Enhanced accessibility with aria-label attributes for improved user navigation and clarity.
app/components/ui-lib.tsx Introduced AriaProps interface in PasswordInput for better accessibility support.
app/locales/cn.ts, app/locales/en.ts Added translations for FullScreen and ShowPassword to improve localization for Chinese and English users.

Poem

In the meadow where buttons gleam,
A rabbit hops, weaving a dream.
With aria whispers, paths unfold,
Making the brave new tales to be told.
Each label clear, each click a song,
Accessibility for all, where we belong! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 58b144b and c9099ca.

Files selected for processing (4)
  • app/components/button.tsx (3 hunks)
  • app/components/chat.tsx (3 hunks)
  • app/components/sidebar.tsx (1 hunks)
  • app/locales/cn.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/locales/cn.ts
Additional comments not posted (9)
app/components/button.tsx (4)

21-21: LGTM! The addition of the aria property improves accessibility.

The new aria property allows developers to pass an accessible label directly to the button, enhancing screen reader support.


38-38: LGTM! The aria-label attribute improves accessibility.

The aria-label attribute for the button element ensures that the button is accessible to screen readers.


42-42: LGTM! The aria-label attribute for the icon div improves accessibility.

The aria-label attribute for the inner div element that renders the icon provides additional context for screen readers.


54-54: LGTM! The aria-label attribute for the text div improves accessibility.

The aria-label attribute for the inner div element that renders the text ensures that the text is accessible to screen readers.

app/components/sidebar.tsx (2)

301-301: LGTM! The addition of the aria attribute improves accessibility.

The aria={Locale.Settings.Title} attribute for the settings icon button provides a descriptive label for screen readers.


310-310: LGTM! The addition of the aria attribute improves accessibility.

The aria={Locale.Export.MessageFromChatGPT} attribute for the GitHub icon button ensures that the button is accessible to screen readers.

app/components/chat.tsx (3)

1340-1341: LGTM! The addition of title and aria attributes improves accessibility.

The title={Locale.Chat.EditMessage.Title} and aria={Locale.Chat.EditMessage.Title} attributes for the edit message button provide descriptive labels for screen readers.


1361-1362: LGTM! The addition of title and aria attributes improves accessibility.

The title={Locale.Chat.Actions.FullScreen} and aria={Locale.Chat.Actions.FullScreen} attributes for the fullscreen toggle button ensure that the button is accessible to screen readers.


1414-1414: LGTM! The addition of the aria attribute improves accessibility.

The aria={Locale.Chat.Actions.Edit} attribute for the edit icon button within the message editing section provides additional context for screen readers.

@Dogtiti
Copy link
Member

Dogtiti commented Aug 7, 2024

感觉是不是还有设置里面的需要添加一下?检测一下所有界面要素

@@ -42,6 +42,7 @@ const cn = {
PinToastAction: "查看",
Delete: "删除",
Edit: "编辑",
FullScreen: "全屏",
Copy link
Member

Choose a reason for hiding this comment

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

en有添加吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

没有

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I feel like there is something else in the settings that needs to be added? Check all interface elements

@mayfwl
Copy link
Contributor Author

mayfwl commented Aug 7, 2024

感觉是不是还有设置里面的需要添加一下?检测一下所有界面要素

ok

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I feel like there is something else in the settings that needs to be added? Check all interface elements

OK

Copy link
Contributor

github-actions bot commented Aug 7, 2024

Your build has completed!

Preview deployment

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c9099ca and 14ff46b.

Files selected for processing (8)
  • app/components/input-range.tsx (2 hunks)
  • app/components/mask.tsx (5 hunks)
  • app/components/model-config.tsx (11 hunks)
  • app/components/sd/sd-panel.tsx (3 hunks)
  • app/components/settings.tsx (49 hunks)
  • app/components/ui-lib.tsx (1 hunks)
  • app/locales/cn.ts (2 hunks)
  • app/locales/en.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/locales/cn.ts
Additional comments not posted (37)
app/components/input-range.tsx (2)

12-12: LGTM! Addition of aria property to InputRangeProps.

The addition of the aria property to the InputRangeProps interface is correct and follows TypeScript conventions.


23-29: LGTM! Usage of aria property in InputRange function.

The usage of the aria property as aria-label in the <input> element is correct and follows best practices for accessibility.

app/components/model-config.tsx (7)

20-20: LGTM! Addition of aria-label attribute to Select component.

The addition of the aria-label attribute to the Select component with the value from Locale.Settings.Model is correct and follows best practices for accessibility.


44-44: LGTM! Addition of aria attribute to InputRange component for Temperature.

The addition of the aria attribute to the InputRange component with the value from Locale.Settings.Temperature.Title is correct and follows best practices for accessibility.


64-64: LGTM! Addition of aria attribute to InputRange component for TopP.

The addition of the aria attribute to the InputRange component with the value from Locale.Settings.TopP.Title is correct and follows best practices for accessibility.


84-84: LGTM! Addition of aria-label attribute to input element for MaxTokens.

The addition of the aria-label attribute to the input element with the value from Locale.Settings.MaxTokens.Title is correct and follows best practices for accessibility.


107-107: LGTM! Addition of aria attribute to InputRange component for PresencePenalty.

The addition of the aria attribute to the InputRange component with the value from Locale.Settings.PresencePenalty.Title is correct and follows best practices for accessibility.


129-129: LGTM! Addition of aria attribute to InputRange component for FrequencyPenalty.

The addition of the aria attribute to the InputRange component with the value from Locale.Settings.FrequencyPenalty.Title is correct and follows best practices for accessibility.


Line range hint 151-221:
LGTM! Addition of aria-label attributes to input elements.

The addition of the aria-label attribute to the input elements with the respective values from Locale.Settings is correct and follows best practices for accessibility.

app/components/sd/sd-panel.tsx (3)

195-195: LGTM! Addition of aria-label attribute to Select component.

The addition of the aria-label attribute to the Select component with the value from item.name is correct and follows best practices for accessibility.


220-220: LGTM! Addition of aria-label attribute to input element of type number.

The addition of the aria-label attribute to the input element of type number with the value from item.name is correct and follows best practices for accessibility.


240-240: LGTM! Addition of aria-label attribute to input element of type text.

The addition of the aria-label attribute to the input element of type text with the value from item.name is correct and follows best practices for accessibility.

app/components/ui-lib.tsx (2)

268-271: LGTM! The AriaProps interface enhances accessibility.

The addition of the aria property allows ARIA attributes to be passed to components, improving accessibility.


275-286: LGTM! The PasswordInput component improvements enhance accessibility.

The PasswordInput component now uses the PasswordInputProps interface, which includes the aria property. The aria prop is passed to the IconButton component, ensuring better accessibility.

app/locales/en.ts (2)

47-47: LGTM! The FullScreen entry enhances localization support.

The addition of the FullScreen entry in the Actions section enhances the localization support for the full-screen mode feature.


139-139: LGTM! The ShowPassword entry enhances localization support.

The addition of the ShowPassword entry in the Settings section enhances the localization support for the show password feature.

app/components/mask.tsx (5)

130-131: LGTM! The div element improvements enhance accessibility.

The div element that triggers the color picker now has tabIndex={0} and aria-label attributes, improving keyboard navigation and accessibility for screen readers.


144-144: LGTM! The input element improvements enhance accessibility.

The input element for the mask's name now has an aria-label attribute, improving accessibility for screen readers.


159-159: LGTM! The input element improvements enhance accessibility.

The input element for hiding context now has an aria-label attribute, improving accessibility for screen readers.


176-176: LGTM! The IconButton element improvements enhance accessibility.

The IconButton element for sharing now has an aria attribute, improving accessibility for screen readers.


190-190: LGTM! The input element improvements enhance accessibility.

The input element for syncing global configuration now has an aria-label attribute, improving accessibility for screen readers.

app/components/settings.tsx (16)

249-249: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.


264-264: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.


518-518: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.


549-549: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.


557-557: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.


695-695: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


715-715: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


731-732: LGTM! Added aria and aria-label attributes for accessibility.

The aria and aria-label attributes are appropriately added to enhance accessibility.


756-756: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


772-772: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


788-788: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


813-813: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


829-829: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


845-845: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


861-861: LGTM! Added aria-label attribute for accessibility.

The aria-label attribute is appropriately added to enhance accessibility.


1283-1283: LGTM! Added aria attribute for accessibility.

The aria attribute is appropriately added to enhance accessibility.

@mayfwl
Copy link
Contributor Author

mayfwl commented Aug 7, 2024

所有的设置添加了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


All settings added

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 14ff46b and 034c82e.

Files selected for processing (1)
  • app/components/sd/sd.tsx (1 hunks)
Additional comments not posted (1)
app/components/sd/sd.tsx (1)

136-136: Accessibility Improvement: Addition of aria attribute

The addition of the aria attribute to the IconButton component enhances accessibility by providing a descriptive label for screen readers. Ensure that the value Locale.Chat.Actions.FullScreen correctly describes the button's action.

app/components/mask.tsx Show resolved Hide resolved

// 定义一个接口 PasswordInputProps,继承自 HTMLProps<HTMLInputElement> 和 AriaProps
// 用于描述密码输入框组件的属性
interface PasswordInputProps extends HTMLProps<HTMLInputElement>, AriaProps {}
Copy link
Member

@Dogtiti Dogtiti Aug 8, 2024

Choose a reason for hiding this comment

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

type Props = HTMLProps & {
aria?: string;
}
是不是就可以了?

或者
interface PasswordInputProps extends HTMLProps{
aria?: string;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,我修改一下

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 034c82e and 0958b9e.

Files selected for processing (1)
  • app/components/ui-lib.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/components/ui-lib.tsx

@Dogtiti
Copy link
Member

Dogtiti commented Aug 8, 2024

close #5079

@Dogtiti Dogtiti merged commit 036358d into ChatGPTNextWeb:main Aug 8, 2024
1 of 2 checks passed
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


close #5079

This was referenced Oct 11, 2024
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