Skip to content

Conversation

@bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Oct 25, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #20594

Description

This PR ensure folder is created on enter as well in media picker. I tried call of #addFolder in keypress function, but it created double folders, so it just trigger blur of input field when hitting Enter key.

I also think it is better to use placeholder here instead of a pre-populated value as the backoffice in generel doesn't do the creating new entities.

Furthermore I changed the plus icon to icon-add as it aligns with add icon in tree and in in media picker placeholder too.

And finally a bit left margin, so the input has a bit distance to the / separator.

Copilot AI review requested due to automatic review settings October 25, 2025 15:43
@github-actions
Copy link

github-actions bot commented Oct 25, 2025

Hi there @bjarnef, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the media picker folder creation UX by allowing users to press Enter to create a new folder, instead of requiring them to click away or tab out of the input field. Additionally, the "add folder" button icon is updated from a simple "+" text to a proper icon component.

  • Adds Enter key handling to trigger folder creation in the media picker
  • Updates the add folder button to use an icon component instead of text

this.dispatchEvent(new UmbChangeEvent());
}

#onKeypress(e: UUIInputEvent) {
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

The parameter type should be KeyboardEvent instead of UUIInputEvent. The key property is not available on UUIInputEvent, which will cause a runtime error. Change the parameter type to KeyboardEvent.

Suggested change
#onKeypress(e: UUIInputEvent) {
#onKeypress(e: KeyboardEvent) {

Copilot uses AI. Check for mistakes.
value="new folder name"
@blur=${this.#addFolder}
@keypress=${this.#onKeypress}
style="margin-left: var(--uui-size-2);"
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Inline styles should be avoided in favor of CSS classes or component styling. Consider moving this style to a CSS class or the component's styles for better maintainability.

Copilot uses AI. Check for mistakes.
auto-width></uui-input>`
: html`<uui-button label="add folder" compact @click=${this.#focusFolderInput}>+</uui-button>`}
: html`<uui-button label="add folder" compact @click=${this.#focusFolderInput}>
<uui-icon name="icon-add" style="--uui-icon-color:inherit;"></uui-icon>
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Inline styles should be avoided in favor of CSS classes or component styling. Consider moving this style to a CSS class or the component's styles for better maintainability.

Copilot uses AI. Check for mistakes.
@emmagarland
Copy link
Contributor

Hi @bjarnef,

Thanks for your PR to fix #20594 around the folder creation via pressing enter key press.

One of the Core Collaborators team will review this as soon as possible. I just updated it from merge, and also noticed it has some AI suggestions - in case they can be resolved in advance!

Best wishes

Emma

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.

Folder in media picker via breadcrumb is first created on blur

2 participants