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

message_edit: Use disabled instead of readonly to disable controls. #22765

Merged
merged 1 commit into from Sep 1, 2022

Conversation

jai2201
Copy link
Collaborator

@jai2201 jai2201 commented Aug 21, 2022

Currently when a user does not have the permission to edit the topic/content
of a message, the edit UI/view source UI correctly shows a greyed
out topic/message-content input field, however these fields incorrectly have a
click behavior, so to fix this we now would want to use disabled prop instead
of readonly attribute as readonly controls can still function and are still
focusable whereas disabled controls can not receive focus and are unclickable.

Fixes #22565

Fixes: 22565.

Screenshots and screen captures:

Self-review checklist

  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

Currently when a user does not have the permission to edit the topic/content
of a message, the edit UI/view source UI correctly shows a greyed
out topic/message-content input field, however these fields incorrectly have a
click behavior, so to fix this we now would want to use `disabled` prop instead
of `readonly` attribute as `readonly` controls can still function and are still
focusable whereas disabled controls can not receive focus and are unclickable.

Fixes zulip#22565.
@jai2201
Copy link
Collaborator Author

jai2201 commented Aug 21, 2022

@timabbott , I looked at the other places where readonly was being used in this file, and it looked like they too needed to be changed to disabled , So I tested the PR changing them all to disabled and it looked to work prefect!
(with readonly attribute the message content field was still focusable which is not the case with disabled so the change looked correct to me;)

Added the reason in commit message;

@timabbott timabbott merged commit 73cfab8 into zulip:main Sep 1, 2022
@timabbott
Copy link
Sponsor Member

This is great, merged, thanks @jai2201!

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.

Uneditable topic field should not be clickable
3 participants