{"id":189,"date":"2025-01-26T16:18:43","date_gmt":"2025-01-26T21:18:43","guid":{"rendered":"https:\/\/www.parhammofidi.com\/blog\/?p=189"},"modified":"2025-01-26T16:18:43","modified_gmt":"2025-01-26T21:18:43","slug":"empowering-designers-and-pms-using-contenteditable-and-designmode-to-tweak-uis-on-the-fly","status":"publish","type":"post","link":"https:\/\/www.parhammofidi.com\/blog\/index.php\/2025\/01\/26\/empowering-designers-and-pms-using-contenteditable-and-designmode-to-tweak-uis-on-the-fly\/","title":{"rendered":"Empowering Designers and PMs: Using `contenteditable` and `designMode` to Tweak UIs on the Fly"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>contenteditable<\/code><\/mark> attribute and <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>designMode<\/code><\/mark> property in HTML bring being able to edit any web page like it&#8217;s a document without touching design tools or development environment into reality. These become particularly powerful when designers and product managers have the ability to experiment with UI changes live in the browser, iterate with speed, and effectively communicate an idea.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><code>contenteditable<\/code> Attribute:<\/strong><br>Adding <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">contenteditable=\"true\"<\/mark><\/code> to an HTML element allows it to be edited directly in the browser. This works for elements like <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">&lt;div><\/mark><\/code>, <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">&lt;span><\/mark><\/code>, or <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>&lt;p><\/code> <\/mark>and retains the element\u2019s styling, providing a real-time editing experience.<\/li>\n\n\n\n<li><strong><code>designMode<\/code> Property:<\/strong><br>By setting <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">document.designMode = \"on\";<\/mark><\/code> or <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">iframeNode.contentDocument.designMode = \"on\";<\/mark><\/code>, you can enable editing for the entire document or iframe content, turning your browser into a live design canvas.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why It Matters for Designers and PMs<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Designers and PMs more often than not have to test or propose changes without having to wait for developers or learn all kinds of complex tools. The following features let them do that quickly and intuitively:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visualize changes directly in the medium, that is, the web browser.<\/li>\n\n\n\n<li>Quickly iterate on copy, layout, or style configurations during presentations or in user feedback sessions.<\/li>\n\n\n\n<li>Share updated concepts with developers as a kind of proof of concept.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Three Real-Life Examples<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. Quickly Test UI Copy Adjustments<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s say you\u2019re evaluating a landing page headline or CTA button text. By setting <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>contenteditable<\/code><\/mark> on the text elements:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;h1 contenteditable=\"true\"&gt;Welcome to Our Website&lt;\/h1&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can edit the headline in real time and see how it feels in the existing layout. This is especially useful for A\/B testing ideas during team meetings.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Create Mockups Without Leaving the Browser<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Activate <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">document.designMode<\/mark><\/code> to test various design elements:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.designMode = \"on\";<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can move elements around, experiment with text, and adjust alignments without ever touching a design tool. Once done, take a screenshot or share the modified page link with stakeholders.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. Simulate Customer Feedback Changes in a Demo<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">During a demo, a client might suggest changes to UI text or layout. With <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">iframeNode.contentDocument.designMode = \"on\";<\/mark><\/code>, you can edit within a contained environment (iframe) to incorporate feedback immediately, impressing clients with your responsiveness.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step-by-Step: See It in Action<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open a webpage in your browser of choice that has a Inspect or Developer Mode<\/li>\n\n\n\n<li>Open the Developer Console (F12 or right-click -&gt; Inspect).<\/li>\n\n\n\n<li>Enter the following in the console to enable <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>designMode<\/code>: <code>document.designMode = \"on\";<\/code><\/mark><\/li>\n\n\n\n<li>Click and start editing any text or repositioning content directly.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For more control, set specific elements to <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">contenteditable<\/mark><\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelectorAll('h1, p').forEach(el =&gt; el.setAttribute('contenteditable', 'true'));<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>See It Live<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1913\" height=\"945\" src=\"https:\/\/www.parhammofidi.com\/blog\/wp-content\/uploads\/2025\/01\/designMode.gif\" alt=\"\" class=\"wp-image-192\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Features like <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\"><code>contenteditable<\/code><\/mark> and <code><mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">designMode<\/mark><\/code> are game-changers in terms of closing the gap between design and development. This enables non-technical roles to participate in active, simple UI refinement, thus enabling quicker iteration and clearer communication with development teams.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The contenteditable attribute and designMode property in HTML bring being able to edit any web page like it&#8217;s a document without touching design tools or development environment into reality. These become particularly powerful when designers and product managers have the ability to experiment with UI changes live in the browser, iterate with speed, and effectively [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":195,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[16,57,159,158,14,157,13,8,160,161],"class_list":["post-189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","tag-collaboration","tag-design","tag-designers","tag-designmode","tag-development","tag-html","tag-learning","tag-productivity","tag-ui","tag-ux"],"_links":{"self":[{"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":3,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/189\/revisions\/196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/195"}],"wp:attachment":[{"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.parhammofidi.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}