Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: Optimise the type of search input to `search`

haitaooc3dd2f40219e
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx
index bb69f7ae..6adab236 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -178,6 +178,7 @@ const Header: FC = () => {
className="w-100 maxw-400"
onSubmit={handleSearch}>
<FormControl
+ type="search"
placeholder={t('header.search.placeholder')}
className="placeholder-search"
value={searchStr}
diff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsx
index 51a712df..bbba4f22 100644
--- a/ui/src/components/TagSelector/index.tsx
+++ b/ui/src/components/TagSelector/index.tsx
@@ -246,8 +246,9 @@ const TagSelector: FC<IProps> = ({
e.preventDefault();
}}>
<FormControl
- placeholder={t('search_tag')}
autoFocus
+ type="search"
+ placeholder={t('search_tag')}
value={searchValue}
onChange={handleSearch}
/>
diff --git a/ui/src/index.tsx b/ui/src/index.tsx
index c7d460b9..2d79405b 100644
--- a/ui/src/index.tsx
+++ b/ui/src/index.tsx
@@ -22,7 +22,8 @@ document.addEventListener(
}
if (/IMG/.test(target.nodeName)) {
- if (!target.getAttribute('alt')) {
+ const altText = target.getAttribute('alt')?.trim();
+ if (!altText) {
target.classList.add('invisible');
}
}
diff --git a/ui/src/pages/Admin/Answers/index.tsx b/ui/src/pages/Admin/Answers/index.tsx
index 1a60332d..e79a1c31 100644
--- a/ui/src/pages/Admin/Answers/index.tsx
+++ b/ui/src/pages/Admin/Answers/index.tsx
@@ -103,7 +103,7 @@ const Answers: FC = () => {
value={curQuery}
onChange={handleFilter}
size="sm"
- type="input"
+ type="search"
placeholder={t('filter.placeholder')}
style={{ width: '12.25rem' }}
/>
diff --git a/ui/src/pages/Admin/Questions/index.tsx b/ui/src/pages/Admin/Questions/index.tsx
index 4992d7fa..7b3367eb 100644
--- a/ui/src/pages/Admin/Questions/index.tsx
+++ b/ui/src/pages/Admin/Questions/index.tsx
@@ -112,7 +112,7 @@ const Questions: FC = () => {
<Form.Control
value={curQuery}
size="sm"
- type="input"
+ type="search"
placeholder={t('filter.placeholder')}
onChange={handleFilter}
style={{ width: '12.25rem' }}
diff --git a/ui/src/pages/Admin/Users/index.tsx b/ui/src/pages/Admin/Users/index.tsx
index e981a882..308835dd 100644
--- a/ui/src/pages/Admin/Users/index.tsx
+++ b/ui/src/pages/Admin/Users/index.tsx
@@ -193,6 +193,7 @@ const Users: FC = () => {
<Form.Control
size="sm"
+ type="search"
value={curQuery}
onChange={handleFilter}
placeholder={t('filter.placeholder')}
diff --git a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
index 3b3a7911..b37650e6 100644
--- a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
+++ b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
@@ -130,6 +130,7 @@ const Index: FC<Props> = ({
{toggleState ? (
<Form.Control
autoFocus
+ type="search"
placeholder={t('search')}
value={searchValue}
onChange={handleSearch}
diff --git a/ui/src/pages/Tags/index.tsx b/ui/src/pages/Tags/index.tsx
index 400e2a49..910f104d 100644
--- a/ui/src/pages/Tags/index.tsx
+++ b/ui/src/pages/Tags/index.tsx
@@ -62,7 +62,7 @@ const Tags = () => {
<Form.Control
value={searchTag}
placeholder={t('search_placeholder')}
- type="text"
+ type="search"
onChange={handleChange}
size="sm"
/>