
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
active-touch
Advanced tools
There are 3 problems with how iOS treats CSS :active
state:
-webkit-tap-highlight-color
is used.<body ontouchstart>
but it won't fix everything:
:active
... very ugly.:active
. Also ugly.:active
state anyway?Even if you have super-fast single-page application, users still want INSTANT feedback when they click/tap your links and buttons, in fact here's what's expected for first-class app experience:
For example, if a user presses a white button (immediately it turns dark) and releases it (it may remain dark) some page loads and the button turns blue to indicate that she is on the page that corresponds to that button.
This library solves the issues within one of the most popular mobile browser (iOS Safari) [as well many others] by adding active
class for every <a>
tag on the page as soon as the user touches them. If the user scrolls or moves the finger away, class is removed. If the user lifts his finger/releases mouse button the active
class remains. This part you can control by calling activeTouch.reset()
- which will remove that class. 🎉
Will add to NPM soon, for now just reference this repo in your package.json like so:
npm install --save dmitrizzle/active-touch
For ES6 projects with Babel:
import { activeTouch } from "active-touch"
activeTouch.reset() // call this function every time you need to remove all `active` classes (like when new page is loaded)
activeTouch.init() // init the touch/click listener functions
By default active-touch iterates through all anchor (link) elements on the page and toggles class "active". You can change that behaviour when you initialize:
activeTouch.init({
cssclass: "custom-class",
selectors: ["a", "button", ".another-selector"]
})
^^ Now, .custom-class
will be toggled on link (<a></a>
), button (<button/>
) and all elements with css class another-selector
that the user presses their finger/mouse button.
Create your own .active{}
CSS style, for example: .active { background: green }
If you are using React, activeTouch should be called once everything has rendered inside your component, with compoentDidMount()
like so:
class App extends React.Component {
componentDidMount() {
activeTouch.reset()
activeTouch.init()
}
render() {
return ( <div><a href="#">link</a></div> )
}
}
In your HTML file, import the compiled JS:
<script src="path-to/active-touch/build/bundle.js"></script>
In your JavaScript, use this:
if(typeof ES6test == "undefined"){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["./index.js"], factory);
} else if (typeof exports !== "undefined") {
factory(require("./index.js"));
} else {
var mod = {
exports: {}
};
factory(global.index);
global.test = mod.exports;
}
})(this, function (_index) {
"use strict";
// init the touch/click listener functions
_index.activeTouch.init();
});
}
FAQs
A solution for :active CSS problem on iOS devices
The npm package active-touch receives a total of 1 weekly downloads. As such, active-touch popularity was classified as not popular.
We found that active-touch demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.