{"id":19006065,"date":"2026-08-29T06:50:41","date_gmt":"2026-08-29T06:50:41","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/bug-select-shortcode-button-fails-typeerror-reading-value\/"},"modified":"2026-08-29T06:50:41","modified_gmt":"2026-08-29T06:50:41","slug":"bug-select-shortcode-button-fails-typeerror-reading-value","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/bug-select-shortcode-button-fails-typeerror-reading-value\/","title":{"rendered":"Bug: &#8220;Select shortcode&#8221; button fails &#8211; TypeError (reading &#8216;value&#8217;)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Description:<br \/>Hello,<br \/><br \/>I am experiencing an issue with the Shortcoder Gutenberg block. When I add the block to a post and click the &#8220;Select shortcode&#8221; button, nothing happens.<br \/><br \/>Upon inspecting the browser console, a JavaScript error is triggered immediately upon clicking. I traced it in the debugger and found the exact line causing the issue in index.js.<br \/><br \/>Error Log:<br \/>Uncaught TypeError: Cannot read properties of null (reading &#8216;value&#8217;)<br \/><br \/>The problematic code in index.js:<br \/><br \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>onClick: () =&gt; {\n    if (window.sc_show_insert) {\n        \/\/ The error occurs on the following line:\n        var e = document.getElementById(\"shortcoder-input-\" + s).value;\n        window.sc_show_insert(e, s)\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br \/><br \/>Cause:<br \/>document.getElementById(&#8220;shortcoder-input-&#8221; + s) is returning null (likely because the element cannot be found in the DOM, possibly due to the block editor&#8217;s iframe canvas in newer WP versions), and accessing .value on it throws the TypeError.<br \/><br \/>Steps to Reproduce:<br \/><br \/>Open the Gutenberg block editor (adding a new post\/page).<br \/><br \/>Insert the &#8220;Shortcoder&#8221; block.<br \/><br \/>Click the blue &#8220;Select shortcode&#8221; button.<br \/><br \/>The UI does not respond, and the console throws the TypeError.<br \/><br \/>Environment &amp; Troubleshooting Performed:<br \/>To rule out conflicts, I used the official Health Check &amp; Troubleshooting plugin. The issue perfectly isolates to Shortcoder.<br \/><br \/>Active Theme: Twenty Twenty-Four<br \/><br \/>Active Plugins: ONLY Shortcoder (all other plugins disabled via troubleshooting mode)<br \/><br \/>Cache: Completely cleared CDN and local browser caches.<br \/><br \/>Could you please look into updating this DOM selection method to be compatible with the current block editor environment? Let me know if you need any additional information. Thank you!<\/p>\n","protected":false},"template":"","class_list":["post-19006065","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19006065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19006065\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19006065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}