Prevent typing beyond max value in Progress Input
What does this MR do and why?
Progress input field within Work Items (currently only available for OKRs) has max
config set to 100
, but it is only enforced until user doesn't use keyboard to input the values, if user uses numeric keys on keyboard, they can easily type in values above 100
, which is invalid behaviour. This MR fixes it by guarding the input in keyup
event, because input[type="number"]
doesn't do it for us!
Screenshots or screen recordings
Before | After |
---|---|
Screen_Recording_2022-12-21_at_4.06.33_PM | Screen_Recording_2022-12-21_at_4.05.00_PM |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Open rails console by running
bin/rails console
within GDK directory. - Enable the feature flag
:hierarchy_db_restrictions
on a project;Feature.enable(:hierarchy_db_restrictions)
. - Enable the feature flag
:okrs_mvc
on the same project;Feature.enable(:okrs_mvc)
. - Visit issues list page for the project by navigating to
http://gdk.test:3000/gitlab-org/gitlab-test/-/issues
. - Create an objective by clicking on dropdown button next to
New issue
and selectingNew objective
from the dropdown. - Once objective is created, click on it to visit its Work Item page, you should be able to see Progress input field.
- Try to set value above
100
.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Kushal Pandya