digitalfortress-tech / typeahead-standalone Goto Github PK
View Code? Open in Web Editor NEWA fast fully-featured standalone autocomplete library
Home Page: https://typeahead.digitalfortress.tech/
License: MIT License
A fast fully-featured standalone autocomplete library
Home Page: https://typeahead.digitalfortress.tech/
License: MIT License
Events added to the input element before using typeahead() are removed because the input element is cloned. Cloning does not copy events:
Events added to the input field after using the typeahead() work fine.
Solution: Use event delegation on the parent span element instead of cloning the input element?
v4.7.0
https://jsfiddle.net/r4f0h9yn/2/
No response
No response
No response
Using vite v4.3.7 with vue 3.3.4. Latest version of typeahead-standalone.
Inserted the colors example into my page. Works great in dev mode but as soon as I build using vite and run in production I get this error --
Uncaught TypeError: Cannot read properties of undefined (reading 'webpackChunktypeahead')
at index-e65366ba.js:2156:108666
at index-e65366ba.js:2156:108754
at index-e65366ba.js:2156:108817
at index-e65366ba.js:2156:96746
at index-e65366ba.js:2156:96751
at index-e65366ba.js:2156:108822
Latest
none
Use standard vue 3 example. Insert example code from typeahead-standalone. Run vite build. Deploy to web site.
Chrome
Uncaught TypeError: Cannot read properties of undefined (reading 'webpackChunktypeahead')
at index-e65366ba.js:2156:108666
at index-e65366ba.js:2156:108754
at index-e65366ba.js:2156:108817
at index-e65366ba.js:2156:96746
at index-e65366ba.js:2156:96751
at index-e65366ba.js:2156:108822
No response
Tested on TS 4.23.0 and 4.21.0. The site given is running 4.21.0. Issue found on Brave (Android), DDG (Android), and Chrome (Android)
Issue: When there are more than 1 input forms nearby, when submitting data(press enter key), rather than data being submitted, the input field just jumps to the second form. It affects only under certain condition.
Latest
Issue Case
https://urltest.pages.dev
.Bank
, select one and submit data. You could see the alert, as well as the 2nd input form displayed.You'll notice rather than submitting data, the pointer is now on the second form.
Another Case, but with Expected Output
Now the data is submitted, as you'd see the alert as well as the other appropriate data.
This issue does not exist on Firefox or other FF variants.
Chrome, Brave
No response
No response
Originally posted by Pfeil May 11, 2023
Hi :) (Sorry, beginner here.) I seem not to be able to use it with vite, but I am not sure what I am doing wrong. I probably have a simple vite issue, but maybe not (minimal example below). I have another webcomponent which works fine, and other dependencies in the same project also do not cause issues. So I wonder if typeahead-standalone has certain requirements? The error only occurs in production build when using it in a script tag in a HTML file (error from the example described below):
Uncaught TypeError: this is undefined
<anonymous> typeahead-standalone.js:1
<anonymous> typeahead-standalone.js:1
<anonymous> typeahead-standalone.js:1
<anonymous> typeahead-standalone.js:1
<anonymous> typeahead-standalone.js:1
<anonymous> some_sample-name.umd.js:370
<anonymous> some_sample-name.umd.js:2
<anonymous> some_sample-name.umd.js:3
typeahead-standalone.js:1:11429
Minimal example can be created like this:
npm create vite@latest com_mapping_input_test -- --template vanilla-ts
import { resolve, dirname } from "path";
import { defineConfig } from "vite";
const __dirname = dirname(__filename);
export default defineConfig({
build: {
sourcemap: true,
lib: {
entry: resolve(__dirname, "src/main.ts"),
name: "some_sample-name",
formats: ["es", "umd"],
fileName: (format) => `some_sample-name.${format}.js`,
},
minify: false,
},
});
import typeahead from "typeahead-standalone";
function hello() {
console.log("hello");
typeahead;
}
npm run preview
and then <script src="http://localhost:4173/com_mapping-service-input.umd.js"></script>
Any ideas? Thanks!
using with typescript throw the following error:
Error: node_modules/typeahead-standalone/dist/index.d.cts:23:32 - error TS2304: Cannot find name 'Dictionary'.
23 function typeahead<T extends Dictionary>(config: typeaheadConfig<T>): typeaheadResult<T>;
~~~~~~~~~~
Error: node_modules/typeahead-standalone/dist/index.d.cts:23:52 - error TS2304: Cannot find name 'typeaheadConfig'.
23 function typeahead<T extends Dictionary>(config: typeaheadConfig<T>): typeaheadResult<T>;
~~~~~~~~~~~~~~~
Error: node_modules/typeahead-standalone/dist/index.d.cts:23:73 - error TS2304: Cannot find name 'typeaheadResult'.
23 function typeahead<T extends Dictionary>(config: typeaheadConfig<T>): typeaheadResult<T>;
~~~~~~~~~~~~~~~
Error: node_modules/typeahead-standalone/dist/index.d.cts:24:3 - error TS2666: Exports and export assignments are not permitted in module augmentations.
24 export default typeahead;
v4.25.1
none
Chrome
No response
No response
Hello,
i am migrating a formular from jquery typeahead to typeahead-standalone in order to use a remote source.
Our api needs a generated signature for a request, so replacing the wildcard after the url()-callback doesn't work in our usecase.
Is there a way to get the frozenInput within the url()-callback?
Or is there an option to use the frozenInput as payload in a post request?
Regards
.nowrap
Expected behavior:
Setting hint:false in the typeahead options will not produce a tt-hint input element in the output html
Actual behavior:
A tt-hint input is created anyway, just not used for hinting
I don't want hinting, and the unused, mis-sized tt-hint input box is making a mess of my search box ui. If I go into devtools and manually delete the tt-hint input element, everything looks and works correctly.
Latest
https://jsfiddle.net/j7xL59m8/
Firefox, Chrome
No response
No response
When we use remote typeahead option to get an ordered dataset from the server by input value, seems that suggestions pop up randomly whenever the input text matches the value, however, it doesn't follow dataset order to check and print matches. For example, if we have a dataset of 50 titles that starts with "tr" ordered by name from the server and after typeahead shows suggestions the first match is not equal to the first record from the dataset. It may lead to retrieving results less relevant causing a bad user experience.
v4.17.0
https://codepen.io/stevens3/pen/WNgvrMN
Chrome, Brave
No response
No response
The component is not displayed into Firefox browser (lastest)
In Chrome is working well
Latest
none
Use the component into Firefox browser
Firefox
No errors
In my case the workaround is set position: unset;
into .tt-list
element
When user type any query text it should be option to search start with string with exact match
Its try to search anywhere in the string also not search exact query string
There should be option of search where we can configure like exactmatch and search start with
its gives the list which not match whole exact word and start with that string
The HTML generated by the javascript is not valid. A span
tag is created to wrap the original input element, a hint input is added, and then a div
tag is also added into that span
. It is not valid HTML to have a div
tag inside a span
.
Additionally, the readonly
attribute is added to the hint input with the value of "true". The readonly
attribute is a boolean value, but the string value of "true" is not a boolean. Boolean attributes should be set with no value at all.
On a side note, I have noticed that on pages that use Bootstrap the hidden input initially appears offset from the original input. A quick fix is to add the style "display: block" to the wrapping span
(which would be needed if this were a div
anyway).
One final note. The attributes of the original input are copied to the added hint input. The id
attribute is not copied which is good, but if the original input has an aria-label
that is copied. That attribute should not be copied.
v4.18.0
https://codepen.io/niketpathak/pen/eYVdGNY
Firefox, Chrome
No response
The codepen is just your default codepen. I don't see the need to create a custom codepen for this. I think the issues are pretty clear as is.
Webpack results in an error in 4.25.0:
Module not found: Error: Package path ./dist/basic.css is not exported from package /home/raja/dev/typeahead-standalone-debug/node_modules/typeahead-standalone (see exports field in /home/raja/dev/typeahead-standalone-debug/node_modules/typeahead-standalone/package.json)
v4.25.0, v4.25.1
NA -- local build
A minimal project to reproduce
index.js:
import typeahead from 'typeahead-standalone';
import 'typeahead-standalone/dist/basic.css';
window.typeahead=typeahead;
webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
mode: 'development',
};
package.json
{
"name": "typeahead-standalone-debug",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"css-loader": "^7.1.1",
"style-loader": "^4.0.0",
"typeahead-standalone": "4.25.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
}
}
No response
> [email protected] build
> webpack
asset bundle.js 19.3 KiB [emitted] (name: main)
runtime modules 670 bytes 3 modules
cacheable modules 14.1 KiB
./src/index.js 122 bytes [built] [code generated]
./node_modules/typeahead-standalone/dist/typeahead-standalone.es.js 14 KiB [built] [code generated]
ERROR in ./src/index.js 2:0-45
Module not found: Error: Package path ./dist/basic.css is not exported from package /typeahead-standalone-debug/node_modules/typeahead-standalone (see exports field in /typeahead-standalone-debug/node_modules/typeahead-standalone/package.json)
webpack 5.91.0 compiled with 1 error in 162 ms
The same process works if typeahead-standalone is fixed to 4.24.0
Tested on Firefox Mobile and Mull Browser.
Open FF mobile app(Android)
https://url.authifyweb.com/
nykaa
. => 3 suggestions should appearNykaa
, submit.Result:
Received different results
Expected Output:
The word Nykaa
gets selected and the a form to submit URL appears.
preventSubmit is: False
On chrome mobile it works as expected.
JS code: https://github.com/authifyWeb/authifyURL/blob/main/resources/script.js
repo : https://github.com/authifyWeb/authifyURL
Latest
https://github.com/authifyWeb/authifyURL
Open FF mobile app(Android)
https://url.authifyweb.com/
Firefox
No response
No response
When using the arrow key to select an item from the suggestions, sometimes nothing gets selected event though there are suggestions in the list. This happens only after the initial requests (caching?) for the pressed keys.
v4.9.0
https://codepen.io/niketpathak/pen/ZExLeEw
No response
No response
No response
Fixing issue#26 introduced a new bug. Appending the input to the parent element, moves it to the end of the DOM tree of the parent element. Probably insertBefore()
should be used instead of appendChild()
in https://github.com/digitalfortress-tech/typeahead-standalone/blob/master/src/typeahead-standalone.ts#L100
v4.8.0
https://jsfiddle.net/57kbLsec/
note changed order of siblings in container element.
No response
No response
No response
Upon focus into the typeahead, before typing input, templates.empty displays a resultSet of defaultItems. The suggestions from these defaultItems can be clicked upon but you cannot arrow-down through the listed suggestions.
Instead, upon arrow-down, the suggestions disappear.
this behavior is displayed in the playground 1: colors option
Latest
https://typeahead.digitalfortress.tech/#playground
Chrome
No response
No response
This library is very useful for widget development where HTML is being injected into an unknown website, but the lack of namespacing of the core function threatens collisions. This library defines one global function called typeahead
. I'm very concerned that should I use this library it will collide with my client's website. I'm injecting HTML directly into their pages as widgets.
So, although I do not have an example of such a collision I'm very wary about it. This is my suggested solution:
export default function digitalfortress$typeahead<T extends Dictionary>(config: typeaheadConfig<T>): typeaheadResult {
I understand such a central change to this library would necessitate a major version number and would cause a bit of documentation rewriting, but other than that I don't foresee much of a problem.
using typeahead-standalone within an bootstrap 5 offcanvas component wont scroll content
Latest
https://codepen.io/C-Alonso-C-Ortega/pen/RwOzdPK
Chrome
No response
No response
I'm triying to use typeahead-standalone
in an existing webpack 4.46.0
project and get the following error when import
the lib
error in ./node_modules/typeahead-standalone/dist/typeahead-standalone.js
Module parse failed: Unexpected token (134:38)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| C = e.source.identity || w,
| x = e.onSubmit || n,
> O = e.source.dataTokens?.constructor === Array ? e.source.dataTokens : void 0,
| L = {},
| N = {},
Latest
none
webpack 4.46
typeahead-standalone
in your proyectChrome
ERROR Failed to compile with 1 errors 23:23:58
error in ./node_modules/typeahead-standalone/dist/typeahead-standalone.js
Module parse failed: Unexpected token (134:38)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| C = e.source.identity || w,
| x = e.onSubmit || n,
> O = e.source.dataTokens?.constructor === Array ? e.source.dataTokens : void 0,
| L = {},
| N = {},
844 modules
I'm using the following ES6 modules
import statement according the documentation and get error
// using ES6 modules
import typeahead from 'typeahead-standalone';
Triying to import directly from dist
path also fails
import typeahead from 'typeahead-standalone/dist/typeahead-standalone';
Working with your example.
There are 2 selections highlighted on the frontend , one with the keyboard selection and other with mouse hover
Latest
https://codepen.io/niketpathak/pen/vYRKdNq
Firefox
No response
The display
callback gets called for every item in the suggestion list instead of only once for the selected item.
v4.10.0
https://jsfiddle.net/9xLhbzne/
No response
{
label: "Gold"
}
{
label: "Grey"
}
{
label: "Green"
}
{
label: "Gold"
}
{
label: "Gold"
}
{
label: "Gold"
}
{
label: "Grey"
}
{
label: "Green"
}
{
label: "Gold"
}
No response
I haven't added anything new other than adding a onSubmit option to your existing code of accessing twitter data. onSubmit option for mouseclick and keystroke have different results.
Latest
https://codepen.io/webVerts/pen/vYjNEGm
Go to the link.
Type in your name and complete the suggestion using mouse click and click enter.
An alert appears and click ok.
Open console log. You'll notice "SometihngSomething" messagge
Now go back and type your name again, this time complete autofilling using keystroke and click enter.
Alert appears, click ok.
Open console log. You can find the stringified data from twitter there, which wasn't available when using mouse.
Brave
No response
No response
Hi there ๐,
As of today the propagation of the native input event is currently commented as a result of a bug.
This way we are not able to react to any changes when the user selects a value from the suggestion-list
. Is there already a solution how this will be handled in the future?
Latest
input
event handler to the input fieldChrome
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.