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

Fix irritating Enter key behaviour in container creation dialog #1861

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ImageRunModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,10 @@ export class ImageRunModal extends React.Component {
</ToggleGroup>
);

/* ignore Enter key, it otherwise opens the first popover help; this clears
* the search input and is still irritating from other elements like check boxes */
const defaultBody = (
<Form>
<Form onKeyDown={e => e.key === 'Enter' && e.preventDefault()}>
Copy link
Member

@mvollmer mvollmer Sep 26, 2024

Choose a reason for hiding this comment

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

I think this calls for a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK! Right, it's better as a comment than only just in the commit message. Added.

{this.state.dialogError && <ErrorNotification errorMessage={this.state.dialogError} errorDetail={this.state.dialogErrorDetail} />}
<FormGroup id="image-name-group" fieldId='run-image-dialog-name' label={_("Name")} className="ct-m-horizontal">
<TextInput id='run-image-dialog-name'
Expand Down
9 changes: 8 additions & 1 deletion test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -1738,9 +1738,16 @@ class TestApplication(testlib.MachineCase):

# Local registry
b.click('button.pf-v5-c-toggle-group__button:contains("localhost:5000")')
b.set_input_text("#create-image-image-select-typeahead", "my-busybox")
b.set_input_text("#create-image-image-select-typeahead", "my-busybox", blur=False)
b.wait_text("button.pf-v5-c-select__menu-item:not(.pf-m-disabled)", "localhost:5000/my-busybox")

# pressing Enter does not disturb the dialog or open popup help
b.wait_val("#create-image-image-select-typeahead", "my-busybox")
b.key("Enter")
time.sleep(0.3)
self.assertFalse(b.is_present(".pf-v5-c-popover"))
b.wait_val("#create-image-image-select-typeahead", "my-busybox")

# Select image
b.click('button.pf-v5-c-select__menu-item:contains("localhost:5000/my-busybox")')

Expand Down