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

feat(read-only): add read only mode to webforms #329

Merged
merged 9 commits into from
Jan 26, 2024
Merged

Conversation

daniel-belcher
Copy link
Collaborator

Purpose

Automatically sets forms into read only mode for certain CMS roles as noted in OY2-26331. Also adds a few minor bug/chore fixes.

Linked Issues to Close

Ticket OY2-26331

Approach

Three different approaches attempted

  • transparent div blocking interaction (bad idea carried from previous project)
  • readonly being set via a context every input read (wasted time and interacted with too many files for this goal)
  • context sets read only specifically in the rhf wrappers for components, passing in a disabled for the controller and readonly for the component.

Assorted Notes/Considerations/Learning

  • Changed footer to be a footer based on feedback many weeks prior
  • Altered Webform component to do loading of values before useFormHook to set default values properly. This should remove the error message of interacting with an uncontrolled component whose value was undefined.

- readonly based off user role
- change the webform component to load data before setting default values through useForm
- this change should fix the controlled component error message
@benjaminpaige benjaminpaige changed the title feat: add read only mode to webforms feat(read-only): add read only mode to webforms Jan 18, 2024
- remove readonly context from majority of components
- use fieldset to set disabled for majority of components
- change readonly role to just state submitter for now
Copy link
Collaborator

@benjaminpaige benjaminpaige left a comment

Choose a reason for hiding this comment

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

Love it!

@daniel-belcher daniel-belcher added the In Testing This PR is being tested by QA label Jan 19, 2024
Copy link
Contributor

@pkim-gswell pkim-gswell left a comment

Choose a reason for hiding this comment

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

iapprove

@pkim-gswell pkim-gswell added status: TESTING PR is being tested by QA and removed enhancement In Testing This PR is being tested by QA labels Jan 24, 2024
@daniel-belcher daniel-belcher added type: FEAT Submit new features and removed status: TESTING PR is being tested by QA labels Jan 26, 2024
@daniel-belcher daniel-belcher merged commit 6f25758 into master Jan 26, 2024
16 checks passed
@daniel-belcher daniel-belcher deleted the oy2-26331 branch January 26, 2024 17:08
Copy link
Contributor

🎉 This PR is included in version 1.5.0-val.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

4 participants