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

Fixed autocomplete bug by enclosing div within a form tag #380 #616

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 4 additions & 5 deletions src/platform/web/ui/session/leftpanel/LeftPanelView.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/*
Copyright 2020 Bruno Windels <bruno@windels.cloud>

Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't introduce any unrelated white space changes

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -71,7 +68,8 @@ export class LeftPanelView extends TemplateView {
}
}
));
const utilitiesRow = t.div({className: "utilities"}, [
const utilitiesRow = t.form({name:"utilities-form"}, [
Copy link
Contributor

Choose a reason for hiding this comment

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

won't this submit the form now when you hit enter on the filter field?

Copy link
Contributor

Choose a reason for hiding this comment

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

probably only the filter field should be in the form, not the button links?

Choose a reason for hiding this comment

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

const utilitiesRow = t.form({ name: "utilities-form", onSubmit: (event) => { event.preventDefault(); // Prevent form submission // Additional code logic if needed }, }, [ // Form elements ]);

By adding the onSubmit event listener to the form element and calling event.preventDefault(), you can prevent the form from submitting when the enter key is pressed within the filter field or any other input field inside the form.

t.div({className: "utilities"}, [
t.a({className: "button-utility close-session", href: vm.closeUrl, "aria-label": vm.i18n`Back to account list`, title: vm.i18n`Back to account list`}),
t.view(new FilterField({
i18n: vm.i18n,
Expand All @@ -97,11 +95,12 @@ export class LeftPanelView extends TemplateView {
"aria-label": gridButtonLabel
}),
t.a({className: "button-utility settings", href: vm.settingsUrl, "aria-label": vm.i18n`Settings`, title: vm.i18n`Settings`}),
])
]);

return t.div({className: "LeftPanel"}, [
utilitiesRow,
roomList
]);
}
}
}