Forum Discussion

JoshSinfield's avatar
JoshSinfield
Copper Contributor
Nov 11, 2021

Disable clicking on image web part

Is it possible to disable the lightbox when clicking on an image web part that doesn't have a link configured?

 

It's confusing the navigation of the page. a simple switch of hyperlink on/off would suffice.

 

Thanks. 

12 Replies

  • boomsyd's avatar
    boomsyd
    Copper Contributor

    here's the simplest workaround:

    1. edit the image webpart
    2. in the "Link" field, insert the URL of the site that the image is being placed in
    3. append a "#" to the end of the URL

     

    • Katie16's avatar
      Katie16
      Copper Contributor

      Thanks boomsyd - this is really useful.

       

      Since my last post, I found another workaround for one-off cases where we don't want an image to be clickable but don't want to use the inject css webpart to disable it across the site. We found that using the 'Mark as decorative' toggle on an individual image makes it unclickable as well as removing the alternative text. I'm not sure how long that option/functionality has been in SharePoint Modern. Slightly baffled why we didn't discover it sooner. 🙂

       

  • itsfelipe's avatar
    itsfelipe
    Copper Contributor
    So I found a solution / workaround...

    Step 1: Install this solution
    https://www.sharepointdiary.com/2020/09/sharepoint-online-inject-custom-css-to-modern-sites.html

    Step 2: Add this line to your custom.css file
    div[id*=vpc_CanvasImg] { pointer-events:none !important; }

    Step 3: Enjoy your coffee
    • Katie16's avatar
      Katie16
      Copper Contributor

      itsfelipe many thanks for this solution - it worked a treat!

      Just one query: could the custom css be modified somehow to allow links on images for the occasional situation where you do want them? Like when you want to link the image to a webpage or a larger version of itself. With this custom css implemented site-wide, it's no longer possible to add a hyperlink to an image at all. At least not on our tenancy. Any ideas?

  • JamesHogg's avatar
    JamesHogg
    Copper Contributor
    Found that if I put the same URL as the page the image is on the page kind of refreshes, but does not change the place. Better than the lightbox. **bleep** SharePoint really makes me hate Microsoft. Why provide a product if you are not going to support it properly and make simple enhancements that make it usable.
    • martin1255's avatar
      martin1255
      Brass Contributor
      Agree with the sentiment on this site. Basic usability. Allow images to be clickable or not. Allow them to be linked or not. Also, when an image is a link, give an option to open in new tab or same page. These are basic UX things that MS crapped the bed on.
  • TheDino's avatar
    TheDino
    Copper Contributor
    Someone is working on that already?
    its disaster... I am just forced to click on all images as I beleave there is some link but wait... there is nothing... just image.

    MS Team... do something about this... there are some standards in WWW and this is not following it.
  • twincode's avatar
    twincode
    Copper Contributor
    Agree. This really needs to be able to disable the click interaction (it is the common use case).

    Please add a simple toggle switch to enable/disable image click interaction. Thanks
    • JaDe's avatar
      JaDe
      Copper Contributor

      twincode The image as a link is a user experience disaster. I've been using the embed web part instead and with an html iframe. It doesn't really work for mobile browsing, but is perfectly crisp on the computer. I typically upload a jpg or png to the site assets folder and set the width and height to the image. I also make my images the exact width of the sharepoint site columns. give it a try.

       

      <iframe src="url_to_image" width="1204" height="100" scrolling="no"></iframe>

  • Mike_OBrien's avatar
    Mike_OBrien
    Copper Contributor
    I have exactly the same problem. Would be great to get a fix on this Microsoft.
    • Jaalders's avatar
      Jaalders
      Copper Contributor

      YES, this really needs to be able to disable.

      A link URL or open image or Don't do anything.

Resources