erming / tabcomplete Goto Github PK
View Code? Open in Web Editor NEWEasy tab completion for HTML inputs
Easy tab completion for HTML inputs
When programmatically emptying the input field the hint is not cleared, causing this issue;
Here's a GIF demonstrating the issue.
x
(clearing) works as expected.x
does not hide the hint. From reading through the code quickly I'd assume this is because it only clears the hint on backspace
keydowns.This is the on-click event for the x
button
$clear.click(function(e) {
e.preventDefault();
$filter_by.val('').trigger('keyup').focus();
});
I've also tried
$clear.on('click', function(e) {
e.preventDefault();
var customEvent = $.Event('keydown');
customEvent.which = 8 // Backspace key
$filter_by.val('').trigger(customEvent).focus();
});
without success.
@erming, do you have any ideas how to solve this? I don't have time right now to properly read through this lib and do a PR :(.
When I put a
in the first example, it shows afghanistan but when I press tab it shows anything but Afghanistan. The textarea works as expected
Is that to be expected?
This was noticed on The Lounge, which uses [email protected]
(in case it's been solved since then), and now uses a textarea
element.
Note that this bug was absent when using an input
element.
See details and screencast of the bug in this issue: thelounge/thelounge#529.
So far a proposed fix has been made in thelounge/thelounge#541 by explicitly checking for !e.ctrlKey
in the handler of the keydown.tabcomplete
event. Is this an acceptable fix? From what I've looked, I couldn't find a better solution.
If the option hint
is set to "select"
then the case of the entered characters remains the same regardless of the case of the word it is being matched to.
My suggestion for a fix is to change this in line 144:
var text = options.hint == "select" ? value : [...]
To this:
var text = options.hint == "select" ? value.slice(0, -word.length) + word : [...]
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.