
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
flatpickr-autocomplete-plugin
Advanced tools
A lightweight flatpickr plugin to control autocomplete attributes on date picker inputs
A lightweight flatpickr plugin that intelligently controls autocomplete and aria-autocomplete attributes on date picker inputs.
Features • Installation • Usage • Demo • API • Contributing
autocomplete and aria-autocomplete attributesBrowser autocomplete can interfere with date pickers, showing irrelevant suggestions from previous form inputs. Flatpickr uses hidden inputs internally, so setting autocomplete="off" on your HTML input doesn't always work as expected.
This plugin solves that problem by intelligently transferring autocomplete attributes to the actual visible input field that users interact with.
<!-- Autocomplete attribute stays on hidden input -->
<input type="text" autocomplete="off" />
<!-- Browser still shows autocomplete suggestions 😞 -->
<!-- Plugin transfers attribute to visible input -->
<input type="text" autocomplete="off" />
<!-- Autocomplete properly disabled! 🎉 -->
npm install flatpickr-autocomplete-plugin
yarn add flatpickr-autocomplete-plugin
<script src="https://cdn.jsdelivr.net/npm/flatpickr-autocomplete-plugin@latest/dist/index.js"></script>
<input id="datepicker" type="text" autocomplete="off" />
import flatpickr from 'flatpickr';
import autocompletePlugin from 'flatpickr-autocomplete-plugin';
flatpickr('#datepicker', {
plugins: [autocompletePlugin()],
});
flatpickr('#datepicker', {
altInput: true,
altFormat: 'F j, Y',
dateFormat: 'Y-m-d',
plugins: [autocompletePlugin()],
});
<input
id="datepicker"
type="text"
autocomplete="off"
aria-autocomplete="none"
/>
flatpickr('#datepicker', {
plugins: [autocompletePlugin()],
});
The plugin is written in TypeScript and includes full type definitions.
import flatpickr from 'flatpickr';
import type { Instance } from 'flatpickr/dist/types/instance';
import autocompletePlugin from 'flatpickr-autocomplete-plugin';
const fp: Instance = flatpickr('#datepicker', {
plugins: [autocompletePlugin()],
});
import Flatpickr from 'react-flatpickr';
import autocompletePlugin from 'flatpickr-autocomplete-plugin';
import 'flatpickr/dist/flatpickr.css';
function DatePicker() {
return (
<Flatpickr
options={{
plugins: [autocompletePlugin()],
}}
data-autocomplete="off"
/>
);
}
<template>
<flat-pickr v-model="date" :config="config" autocomplete="off" />
</template>
<script>
import flatPickr from 'vue-flatpickr-component';
import autocompletePlugin from 'flatpickr-autocomplete-plugin';
import 'flatpickr/dist/flatpickr.css';
export default {
components: { flatPickr },
data() {
return {
date: null,
config: {
plugins: [new autocompletePlugin()],
},
};
},
};
</script>
autocompletePlugin()Creates a new instance of the autocomplete plugin.
Returns: Plugin - A flatpickr plugin instance
Example:
const plugin = autocompletePlugin();
flatpickr('#datepicker', {
plugins: [plugin],
});
The plugin automatically transfers the following attributes:
| Attribute | Description | Example Values |
|---|---|---|
autocomplete | Controls browser autocomplete | "off", "on", "new-password", etc. |
aria-autocomplete | ARIA autocomplete state | "none", "inline", "list", "both" |
When multiple input elements exist, the plugin follows this priority:
Check out the live demo served via GitHub Pages to see the plugin in action!
Visit https://bearholmes.github.io/flatpickr-autocomplete-plugin/examples/demo.html to explore:
# Run the full Jest suite
npm test
# Watch tests while developing
npm run test:watch
# Generate coverage report
npm run test:coverage
npm install
npm run build # Produce dist bundles via Rollup
npm run dev # Rollup watch mode for local development
npm run type-check # TypeScript compilation without emit
npm run lint # ESLint with TypeScript rules
npm run format # Prettier formatting
npm run format:check # Prettier verification
npm run format:check, npm run lint, and npm test; execute bash .husky/pre-commit locally to mirror that guardrail before commit.npm run type-check and npm run build so pull requests validate formatting, linting, types, tests, and the bundle.main via GitHub Pages; the live URL is https://bearholmes.github.io/flatpickr-autocomplete-plugin/examples/demo.html.Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)MIT © bearholmes
FAQs
A lightweight flatpickr plugin to control autocomplete attributes on date picker inputs
We found that flatpickr-autocomplete-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.