“data loss”<\/a> and we want to avoid that.<\/p>\n\n\n\nBottom line: Understand why your users need to select text on your website and add the controls in a way that gets out of the way of what they’re trying to do.<\/p>\n","protected":false},"excerpt":{"rendered":"
Click, drag, release: you\u2019ve just selected some text on a webpage\u2009\u2014\u2009probably to copy and paste it somewhere or to share it. Wouldn’t it be cool if selecting that text revealed some options that make those tasks easier? That\u2019s what a selection menu does. You may already be familiar with selection menus if you\u2019ve ever used […]<\/p>\n","protected":false},"author":250902,"featured_media":338216,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"How to Create Actions for Selected Text With the Selection API by @rpsthecoder","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[4],"tags":[1620,18930],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/04\/selection-api-selected-text-actions.png?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":363724,"url":"https:\/\/css-tricks.com\/css-custom-highlight-api-early-look\/","url_meta":{"origin":338189,"position":0},"title":"CSS Custom Highlight API: The Future of Highlighting Text Ranges on the Web","date":"March 1, 2022","format":false,"excerpt":"Styling ranges of text in software is a very useful thing to be able to do. Thankfully, we have the CSS Custom Highlight API to look forward to because it represents the future of styling text ranges on the web. One example: if you\u2019ve ever used text editing software like\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/text-selection-styling.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8921,"url":"https:\/\/css-tricks.com\/reveal-a-background-image-upon-text-selection\/","url_meta":{"origin":338189,"position":1},"title":"Reveal a Background Image upon Text Selection","date":"April 4, 2011","format":false,"excerpt":"Highlight text, reveal an actual image beneath! Not possible with the text selection pseudo class, but is possible by wrapping selected text in spans via an open source JavaScript library and adding the background image to that.","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2011\/04\/raptortext.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":275108,"url":"https:\/\/css-tricks.com\/what-i-learned-by-building-my-own-vs-code-extension\/","url_meta":{"origin":338189,"position":2},"title":"What I Learned by Building My Own VS Code Extension","date":"August 20, 2018","format":false,"excerpt":"VS Code is slowly closing the gap between a text editor and an integrated development environment (IDE). At the core of this extremely versatile and flexible tool lies a wonderful API that provides an extensible plugin model that is relatively easy for JavaScript developers to build on. With my first\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/08\/allautocomplete.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":375098,"url":"https:\/\/css-tricks.com\/creating-a-settings-ui-for-a-custom-wordpress-block\/","url_meta":{"origin":338189,"position":3},"title":"Creating a Settings UI for a Custom WordPress Block","date":"November 17, 2022","format":false,"excerpt":"So far, we\u2019ve covered how to work with data from an external API in a custom WordPress block. We walked through the process of fetching that data for use on the front end of a WordPress site, and how to render it directly in the WordPress Block Editor when placing\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/09\/wordpress-blocks-api.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":363339,"url":"https:\/\/css-tricks.com\/getting-started-with-the-file-system-access-api\/","url_meta":{"origin":338189,"position":4},"title":"Getting Started With the File System Access API","date":"February 14, 2022","format":false,"excerpt":"The File System Access API is a web API that allows read and write access to a user's local files. It unlocks new capabilities to build powerful web applications, such as text editors or IDEs, image editing tools, improved import\/export, all in the frontend. Let\u2019s look into how to get\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/file-system-prompt.png.webp?fit=1200%2C759&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":285849,"url":"https:\/\/css-tricks.com\/using-the-web-speech-api-for-multilingual-translations\/","url_meta":{"origin":338189,"position":5},"title":"Using the Web Speech API for Multilingual Translations","date":"April 12, 2019","format":false,"excerpt":"Since the early days of science fiction, we have fantasized about machines that talk to us. Today it is commonplace. Even so, the technology for making websites talk is still pretty new. We can make our pages on the web talk using the SpeechSynthesis part of the Web Speech API.\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/04\/hello.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338189"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/250902"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=338189"}],"version-history":[{"count":10,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338189\/revisions"}],"predecessor-version":[{"id":339547,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/338189\/revisions\/339547"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/338216"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=338189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=338189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=338189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}