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

Do not focus custom fields in the create child dialog #17636

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

cbliard
Copy link
Member

@cbliard cbliard commented Jan 16, 2025

Ticket

PR #17625
Late review revealed an issue. This PR is a follow-up about it.

What are you trying to accomplish?

In the create child dialog, displayable from the relations tab of a work package, custom fields using the autocompleter input field are getting the focus by default. This is visible only if the work package type has some specific kind of custom fields like hierarchy, version or list.

This is not correct: the field to focus is the subject field.

Also add a test to ensure that all different kind of custom fields are displayed in the create child dialog and no error is reported.

What approach did you choose and why?

Pass in focusDirectly: false so that the focus is not stolen. This may benefit some other areas of the app.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

The field to focus is the subject field.

Also test that all custom fields are displayed in the create
child dialog.

Also updated the `:custom_field` factory for "hierarchy" to create the
root item using `CustomFields::Hierarchy::HierarchicalItemService.new`
by default. A factory should not created half-baked objects.
@cbliard cbliard force-pushed the fix/60590-follow-up-fix-focus-on-custom-fields branch from a836184 to 27a75c7 Compare January 16, 2025 16:39
Copy link
Contributor

@NobodysNightmare NobodysNightmare left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix. I had one comment on the way that the custom field types are iterated, let me know what you think :)

Reproduction command: rspec --seed 10236 './spec/migrations/rename_visible_to_admin_only_in_custom_fields_spec.rb[1:1:1]' './spec/models/queries/projects/project_query_custom_field_order_spec.rb[1:5:1:1]'
Refactored some methods to use `OpenProject::CustomFieldFormat` to get
the `multi_value_possible` information.
Copy link
Contributor

@NobodysNightmare NobodysNightmare left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants