Skip to main content
Participating Frequently
January 15, 2025
Answered

Possible to remove highlighted border to selected button in Acrobat

  • January 15, 2025
  • 2 replies
  • 1348 views

Hey everyone! I have recently made an interactive PDF that has a large amount of buttons and show/hide features, and one of the questions that the client has asked is if there is a way to prevent the 'selected button' box highlight from showing in the end. I think this must be a preference to one's own settings on their Acrobat, but I thought I would check here in case someone new? I don't even know what you would call that box other than button selection, so even searching for it is confusing to me. Here are some screenshots of what I am referring to. One shows the box around text (built into a button) and one shows the box around an icon serving as a button. I've also attached the Interactive PDF to the post in case you want to see it happen on your end. 

Thanks for any info you can offer! I'm always referring to the forums, so if the answer exists, I'm confident you all can help.

 

Correct answer PDF Automation Station

The highlight stays there until a blur event (tabbing to another field or clicking anywhere else in the document).  One way around this is to add the following Mouse Up action script:

this.getField("Text").setFocus();

With "Text" being the name of the next field you would want to the focus to go to.  

2 replies

PDF Automation Station
Community Expert
Community Expert
January 15, 2025

The highlight stays there until a blur event (tabbing to another field or clicking anywhere else in the document).  One way around this is to add the following Mouse Up action script:

this.getField("Text").setFocus();

With "Text" being the name of the next field you would want to the focus to go to.  

Participating Frequently
January 15, 2025

Thank you! I think that makes sense. Where would I put this script when working it into the buttons? Within InDesign before I export the Interactive PDF? "On click" and then which? I don't see a 'run javascript' option. Or would it need to happen on the PDF after I created it? 

Participating Frequently
January 15, 2025

FWIW, I believe I may have found it, but the question remains if I can remove it from the functionality so that it doesn't show on anyone's computer, regardless of their preferences. Looks like Adobe Preferences refers to it as a "focus rectangle." I'm betting the answer is no.

 

PDF Automation Station
Community Expert
Community Expert
January 15, 2025

The following script will turn it off:

app.focusRect=false;

However, it's not good practice to change someone's preferences using a form without warning them.  You could obtain their preference, set focusRect to false on Mouse Enter, then return it to their preference on On Blur like this:

Mouse Enter Script

var focus=app.focusRect;
app.focusRect=false;

On Blur Script

app.focusRect=focus;