{"_id":"interestfor","_rev":"6-1ccffaed5584f4972d97af155fc26ee2","name":"interestfor","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.3":{"name":"interestfor","version":"1.0.3","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","_id":"interestfor@1.0.3","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"dist":{"shasum":"7b36623d81f3ab4d8943910b1d3a63b0e4a5f0c4","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.3.tgz","fileCount":8,"integrity":"sha512-vdMwcLTud8UNgCGaMi+Hs8ZV7jmFnVAyO+wc2JK8c1KLffK4BD1Chtymut0bRu4esCGnOp57sQSK3OF0mJnVIg==","signatures":[{"sig":"MEYCIQCngtnlQP3p5yvf8iec+ndNtMW4mffPteJP5wt0C469QAIhANkO2aFauQPgURZzXr+K9ny9U6a4WYZqFe1eREhogSdO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34970},"main":"src/interestfor.min.js","gitHead":"9d3ced921dd2a71c0ea99cbbebcb58456990dcbc","_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"repository":{"url":"git://github.com/mfreed7/interestfor.git","type":"git"},"_npmVersion":"10.2.4","description":"A polyfill for the `interestfor` API","directories":{},"_nodeVersion":"21.5.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/interestfor_1.0.3_1749595028078_0.4197335602519616","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"interestfor","version":"1.0.4","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","_id":"interestfor@1.0.4","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"dist":{"shasum":"0407748ec6b5b1ec27a90eec4bc7d3fdfa490fd6","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.4.tgz","fileCount":8,"integrity":"sha512-3H8sglc/zNAQu1er3LYheiKIVGSmAfrcpT6btXlmviIrbYI+Jo5QY1zck/FZ4KjD49gU5kj67Fu7+I3fFbjMIw==","signatures":[{"sig":"MEUCIFh/b0/MLZnu0DF7OSbW15jagiOO7T0eFoL6En62bQw3AiEAiOsj8LbmqjOQhcY6C9MHp01XpthFR+FqkmmDAkSo3go=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33155},"main":"src/interestfor.min.js","gitHead":"f041869c7185e306181c3191fe0052b1313579dc","_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"repository":{"url":"git://github.com/mfreed7/interestfor.git","type":"git"},"_npmVersion":"11.5.1","description":"A polyfill for the `interestfor` API","directories":{},"_nodeVersion":"24.6.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/interestfor_1.0.4_1758140822963_0.09772173873835333","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"interestfor","version":"1.0.5","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","_id":"interestfor@1.0.5","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"dist":{"shasum":"951ca94048b7945161ef5905949ac09969098f56","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.5.tgz","fileCount":10,"integrity":"sha512-eCYQb9JTM5Da54efwpSJer87/vdi0XjWS+w844zwLXpPI/kqTJOb3pPDDaPCTQVS/oHCyylj3ry0p5g+a0nLDQ==","signatures":[{"sig":"MEQCIE3ZfqbMZVomOta1V9+s3Xa2GFDh6pXyj2diGasnD/3oAiAZE7aaLAlV7S9EXhbztGa7wKT0rQcJVs1QV9Su7aC36w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42133},"main":"src/interestfor.min.js","gitHead":"4d01864f0f63aba30c856f54e5ed3f92e9cbed9b","_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"repository":{"url":"git://github.com/mfreed7/interestfor.git","type":"git"},"_npmVersion":"11.5.1","description":"A polyfill for the `interestfor` API","directories":{},"_nodeVersion":"24.6.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/interestfor_1.0.5_1758236392679_0.048113495004960205","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"interestfor","version":"1.0.6","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","_id":"interestfor@1.0.6","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"dist":{"shasum":"48cd3ac23fabe28c83d4ab282c0fe92b0c383b0d","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.6.tgz","fileCount":10,"integrity":"sha512-nw6lFAOA9muAhaaGBJ+XtKFO86mpKgG/I4M2kGpWWVICeFdi1y4iVnK1xxLax6G+tZcOikA9ZvBSXLUuMvuR0Q==","signatures":[{"sig":"MEUCIDqrGC9AF0B49hsSFxOGOeFIZINOjFfzijBNSql5IIucAiEAmuZxvp7XXNXGfphiCWR4SyQtE+OdbUlFcFUZucMVky4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42278},"main":"src/interestfor.min.js","gitHead":"964212d9eaeada9aaeb1eead2905e033870b755f","_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"repository":{"url":"git://github.com/mfreed7/interestfor.git","type":"git"},"_npmVersion":"11.5.1","description":"A polyfill for the `interestfor` API","directories":{},"_nodeVersion":"24.6.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/interestfor_1.0.6_1758645327671_0.3919448519269597","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"interestfor","version":"1.0.7","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","_id":"interestfor@1.0.7","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"dist":{"shasum":"4937272886fc0667d50b4d3a81d6deec30fe958b","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.7.tgz","fileCount":10,"integrity":"sha512-qJaN6JMrAjiA+aQ6TkQemZhLx5E8kGI9s0yXAJJbQHSKs0iBKrDc5nMNgGqH1V4x0ZveFJjVbmText/zTI7ZBg==","signatures":[{"sig":"MEYCIQDoZJ/HRCs2U6tDQEYv7gySOSyFoKd2G476MAzdRkAZ0gIhAPnxX0jD40wfvmBlwAGgXeKu3iTluC25taz1ohGKHi5u","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42629},"main":"src/interestfor.min.js","gitHead":"39a023beaa1b54b640ac797c4382038068d8df30","_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"repository":{"url":"git://github.com/mfreed7/interestfor.git","type":"git"},"_npmVersion":"11.5.1","description":"A polyfill for the `interestfor` API","directories":{},"_nodeVersion":"24.6.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/interestfor_1.0.7_1759774587249_0.5462261067512264","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"interestfor","version":"1.0.8","description":"A polyfill for the `interestfor` API","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"homepage":"https://github.com/mfreed7/interestfor#readme","bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"repository":{"type":"git","url":"git://github.com/mfreed7/interestfor.git"},"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","main":"src/interestfor.min.js","gitHead":"65005851d05b8aefc2be9de08d6ff886a5d706d9","_id":"interestfor@1.0.8","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-qYwTmxzDnrosGZX/1lDEOsAv73aYiFKLniN20SS78588WhRMHj8z7u2uFe9QZPIVmkCyIbJwiMQ/85Up7hrseQ==","shasum":"4c940b1a7c772b1f8ce946694ed84eecdff57d72","tarball":"https://registry.npmjs.org/interestfor/-/interestfor-1.0.8.tgz","fileCount":10,"unpackedSize":44517,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD67IaDiVlzWVAhSMgK+/mbAVsXL3EcVoUUbFfffps8/AIgVpknLfSxo83L9UIdoKSuVdnga8ZW08cWOXcaPchC1T4="}]},"_npmUser":{"name":"mfreed7","email":"mfreed@mfreed.com"},"directories":{},"maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/interestfor_1.0.8_1773275508958_0.7638958005527803"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-10T22:37:08.077Z","modified":"2026-03-12T00:31:49.250Z","1.0.3":"2025-06-10T22:37:08.251Z","1.0.4":"2025-09-17T20:27:03.140Z","1.0.5":"2025-09-18T22:59:52.889Z","1.0.6":"2025-09-23T16:35:27.857Z","1.0.7":"2025-10-06T18:16:27.466Z","1.0.8":"2026-03-12T00:31:49.123Z"},"bugs":{"url":"https://github.com/mfreed7/interestfor/issues"},"author":{"name":"Mason Freed","email":"mfreed@mfreed.com"},"license":"BSD-3-Clause","homepage":"https://github.com/mfreed7/interestfor#readme","keywords":["interestfor","interesttarget","polyfill","hover-triggering"],"repository":{"type":"git","url":"git://github.com/mfreed7/interestfor.git"},"description":"A polyfill for the `interestfor` API","maintainers":[{"name":"mfreed7","email":"mfreed@mfreed.com"}],"readme":"# `interestfor` Polyfill\n\nA polyfill for the `interestfor` attribute. This is a new API for \"interest\ninteractions\" that is in the process of being implemented in browsers. It [shipped](https://chromestatus.com/feature/4530756656562176)\nin Chromium browsers (e.g. Chrome, Edge) in version 142 (October 2025).\nSee the MDN documentation for more details:\n\nhttps://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using_interest_invokers\n\n## Usage\nTo use this polyfill, simply load it:\n\n```html\n<script src=\"interestfor.min.js\" async></script>\n\n<a interestfor=foo href=bar>Link</a>\n<div popover id=foo>Popover</div>\n```\n\n## Behavior Summary\n\nAdding the `interestfor` attribute to a button or link (the \"interest\ninvoker\"), and giving it a value that is the IDREF of another element (the\n\"target\" element), will cause the target to get \"interest\" and \"loseinterest\"\nevents when the user \"shows interest\" in the interest invoker. Showing interest\ncan be done by hovering the element with the mouse, or focusing it with the\nkeyboard. If the target is a popover, it will automatically be shown and hidden\nupon receiving and losing interest.\n\nAgain, this is a quick summary. For the complete details, please [read the\nexplainer](https://open-ui.org/components/interest-invokers.explainer).\n\n## Touchscreen support\n\nThis polyfill provides limited touchscreen support. On a touchscreen,\nlong-pressing a `<button>` element that has an `interestfor` attribute will show\ninterest in the target.\n\nHowever, long-pressing a link (`<a>` element) is **not** supported. This is\nbecause on today's browsers, long-pressing a link element brings up a useful\ncontext menu that contains items like \"Share\" and \"Open in new tab\". In order\nfor the polyfill to support interest on links, that context menu would need to\nbe surpressed completely. There is currently no way to provide access to the\nlong-press context menu and *also* provide a way to show interest. Since the\ncontext menu contains items that users often use, eliminating access to the\ncontext menu is not what most people want. So this polyfill will not support\nlong-press on links.\n\nThis is one of the primary motivations for Chromium championing this as a\nnative API in all browsers: to support all users, including those using\ntouchscreens. If you'd like to weigh in on the need for this native API,\nplease feel free to comment on the standards positions for the non-supporting\nbrowsers:\n\n- WebKit: https://github.com/WebKit/standards-positions/issues/464\n- Mozilla: https://github.com/mozilla/standards-positions/issues/1181\n\n\n## Implementation\nThe polyfill adds event listeners to document.body that monitor for hover\nor keyboard events relevant for the `interestfor` API. When interesting\nevents happen to elements with the `interestfor` attribute or elements that\nare the targets of those elements, it fires `interest` and `loseinterest`\nevents on the target of the `interestfor` attribute. If the\ntarget is a popover, it also handles showing or hiding the popover.\n\nBecause this is a polyfill, a few things are slightly different than the\nnative feature:\n\n- The CSS properties for controlling delays are implemented as custom\n  properties, so you'll want to add both the regular property and the custom\n  property, prefixed with `--`, to your stylesheet:\n\n  ```css\n  [interestfor] {\n    interest-delay-start: 400ms;\n    --interest-delay-start: 400ms;\n    interest-delay-end: 200ms;\n    --interest-delay-end: 200ms;\n  }\n  /* Or, use the shorthand: */\n  [interestfor] {\n    interest-delay: 400ms 200ms;\n    --interest-delay: 400ms 200ms;\n  }\n  /* The keyword `normal` can also be used to specify the default delay: */\n  [interestfor] {\n    interest-delay-end: normal;\n    --interest-delay-end: normal;\n  }\n  ```\n\n- The CSS pseudo classes for detecting invoker and target interest states are\n  implemented as regular class names, so again add both to your stylesheet:\n\n  ```css\n  :is([interestfor]:interest-source),\n  [interestfor].interest-source {\n    /* invoker styles */\n  }\n  :is([popover]:interest-target),\n  [popover].interest-target {\n    /* target popover styles */\n  }\n  ```\n\n  Note the `:is()` wrapped around the \"normal\" selector for the real pseudo\n  class names. This is to avoid the entire selector being invalidated if the\n  browser does not recognize the native pseudo class (e.g. `:interest-source`).\n\n\n## Tests\n\nThe `test/test.html` file exercises the various parts of this feature and tests\nfor correctness. This is a manual test, since hovering, keyboard-focusing, etc.\ncannot be done programmatically. The test is capable of testing either the\npolyfill (optionally minified) or the native feature. You can run tests directly\nfrom this repo,\n[here](https://mfreed7.github.io/interestfor/test/test.html).\n\n## Browser Compatibility\n\nThis polyfill uses all standard APIs, and is therefore compatible with all\nmodern browsers, including Safari and Firefox.\n\n## Improvements / Bugs\n\nIf you find issues with the polyfill, feel free to file them [here](https://github.com/mfreed7/interestfor/issues).\nEven better, if you would like to contribute to this polyfill, I'm happy to review [pull requests](https://github.com/mfreed7/interestfor/pulls).\nThanks in advance!\n","readmeFilename":"README.md"}