getgrav / getgrav/grav-plugin-admin

Pressing 'Enter' within input in modal hides the modal

Open
#2,300 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

I have created a modal to quickly create a news page from the admin dropdown at the top, and in general it works fine, but when the input field (for the page title) has focus and 'Enter' is pressed, the modal is just hidden, like it is cancelled.

I'd expect either nothing to happen, or perhaps to have this function as the submit/next action - although that might also be undesirable.

A quick look through the event handlers in the browser devtools did not yet lead me to the code that's causing this.

This is the modal blueprint (`user/blueprints/admin/pages/add_news_item.yaml`):
```yaml
form:
validation: loose
fields:
section:
type: section
title: ADMIN_MODAL.ADD_NEWS_ITEM.MODAL_TITLE

title:
type: text
label: ADMIN_MODAL.ADD_NEWS_ITEM.TITLE_LABEL
validate:
required: true

folder:
type: hidden
default: '@slugify-title'

route:
type: hidden
default: /nieuws

name:
type: hidden
default: 'news-item'

visible:
type: hidden
default: ''

blueprint:
type: blueprint
```

And it is added via `user/config/plugins/admin.yaml` like this:
```yaml
add_modals:
-
label: ADMIN_MODAL.ADD_NEWS_ITEM.MODAL_TITLE
blueprint: admin/pages/add_news_item
show_in: dropdown
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.