Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Autocompleter box size matches the content width #1175

Merged
merged 2 commits into from
Feb 3, 2025
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
8 changes: 8 additions & 0 deletions static/skin/autoComplete/css/autoComplete.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

.autoComplete_wrapper > ul {
position: absolute;
min-width: 100%;
width: fit-content;
max-width: 600px;
max-height: 226px;
overflow-y: scroll;
top: 100%;
Expand Down Expand Up @@ -60,6 +63,11 @@
transition: all 0.2s ease;
}

.autoComplete_wrapper > ul > li > a {
overflow: hidden;
text-overflow: ellipsis;
}

.autoComplete_wrapper > ul > li::selection {
color: rgba(#ffffff, 0);
background-color: rgba(#ffffff, 0);
Expand Down
5 changes: 4 additions & 1 deletion static/skin/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
// in the JS code we have to URI-encode a second time.
// (see https://stackoverflow.com/questions/33721510)
const uriEncodedJSCode = encodeURIComponent(jsCodeString);
return `<a ${linkAttr} href="javascript:${uriEncodedJSCode}">${linkText}</a>`;
const linkPlainText = htmlDecode(linkText, "text/html");
linkAttr += ` href="javascript:${uriEncodedJSCode}"`;
linkAttr += ` title="${linkPlainText}"`;
return `<a ${linkAttr}>${linkText}</a>`;
}

function suggestionsApiURL()
Expand Down Expand Up @@ -448,7 +451,7 @@
keys: ['label'],
},
submit: true,
searchEngine: (query, record) => {

Check notice on line 454 in static/skin/viewer.js

View check run for this annotation

codefactor.io / CodeFactor

static/skin/viewer.js#L454

'record' is defined but never used. (no-unused-vars)

Check notice on line 454 in static/skin/viewer.js

View check run for this annotation

codefactor.io / CodeFactor

static/skin/viewer.js#L454

'query' is defined but never used. (no-unused-vars)
// We accept all records
return true;
},
Expand Down
8 changes: 4 additions & 4 deletions test/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ResourceCollection resources200Compressible{
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/autoComplete/autoComplete.min.js" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/autoComplete/autoComplete.min.js?cacheid=1191aaaf" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/autoComplete/css/autoComplete.css" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/autoComplete/css/autoComplete.css?cacheid=ef30cd42" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/autoComplete/css/autoComplete.css?cacheid=f2d376c4" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/i18n.js" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/i18n.js?cacheid=071abc9a" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/index.css" },
Expand All @@ -75,7 +75,7 @@ const ResourceCollection resources200Compressible{
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/taskbar.css" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/taskbar.css?cacheid=80d56607" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/viewer.js" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/viewer.js?cacheid=aca897b0" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/viewer.js?cacheid=8ca16f13" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/fonts/Poppins.ttf" },
{ STATIC_CONTENT, "/ROOT%23%3F/skin/fonts/Poppins.ttf?cacheid=af705837" },
{ DYNAMIC_CONTENT, "/ROOT%23%3F/skin/fonts/Roboto.ttf" },
Expand Down Expand Up @@ -323,11 +323,11 @@ R"EXPECTEDRESULT( <img src="${root}/skin/download-white.svg?cac
/* url */ "/ROOT%23%3F/viewer",
R"EXPECTEDRESULT( <link type="text/css" href="./skin/kiwix.css?cacheid=2158fad9" rel="Stylesheet" />
<link type="text/css" href="./skin/taskbar.css?cacheid=80d56607" rel="Stylesheet" />
<link type="text/css" href="./skin/autoComplete/css/autoComplete.css?cacheid=ef30cd42" rel="Stylesheet" />
<link type="text/css" href="./skin/autoComplete/css/autoComplete.css?cacheid=f2d376c4" rel="Stylesheet" />
<script type="text/javascript" src="./skin/polyfills.js?cacheid=a0e0343d"></script>
<script type="module" src="./skin/i18n.js?cacheid=071abc9a" defer></script>
<script type="text/javascript" src="./skin/languages.js?cacheid=ee7d95b5" defer></script>
<script type="text/javascript" src="./skin/viewer.js?cacheid=aca897b0" defer></script>
<script type="text/javascript" src="./skin/viewer.js?cacheid=8ca16f13" defer></script>
<script type="text/javascript" src="./skin/autoComplete/autoComplete.min.js?cacheid=1191aaaf"></script>
const blankPageUrl = root + "/skin/blank.html?cacheid=6b1fa032";
<label for="kiwix_button_show_toggle"><img src="./skin/caret.png?cacheid=22b942b4" alt=""></label>
Expand Down
Loading