Developer forum

Forum » Swift » Swift - Accessibility settings issues on tablet

Swift - Accessibility settings issues on tablet

Marie Louise Veigert
Reply

Hi,

We have a client which have an issue regarding show rows on tablet.
If they set the settings 'Hide for desktop' and 'Hide for mobile' on an element, which should only be shown on tablet, it doesn't show on tablet either.
It seems like the tables always get the 'desktop' version. 

I cannot see Im able to do anything to fix this? It looks like it inside DW somewhere?

They are running a older Swift (1.21), but is not in a position to upgrade at the moment, so Im looking into fixing this another way if possible. 
Any suggestions?

BR
Marie Louise


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Marie

I may be wrong, but I think I read, some years ago, that tablets would render websites acting as desktops. You could try to not enabling "Hide for desktop", and test if the page shows on your tablet. 

Let me know about your findings.

 

Best regards
Karsten Thuen

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

iPad pro renders like a desktop. Other ipads does not.

 
Marie Louise Veigert
Reply

They are using Ipad Gen 9 and I have reproduced the issue :) 
I have hided on desktop and set to show on Ipad and mobile.

Are there a way to overwrite these settings in some ways to get it to work? Doesn't look like I have access to it :) 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Marie Louise

This is a seriously complicated issue.....

First of all - you can test the device type switching by specifying a specific device type in the querystring - ?devicetype=Tablet - this will override the default device type detection so you can see if it renders correctly.

You can override the server side DW device detection using "Standard.Page.DeviceDetected" notification. But it is a shit game... Especially for iPad as they 'lie' about what they are. Also an iPad is often configured to act like a desktop or phone, so you cannot detect it server side no matter what you do.

If you can get hold of their specific useragent string on their specific device.

On an iPad you have this:

Settings -> Safari -> Request Desktop Website -> All websites. That option is enabled by default. You can disable it and the proper User Agent is now displayed.

Mozilla/5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1

Which will trigger the right agent and cause the ipad to be detected as an iPad. But many ipads have SPECIFICALLY been setup to be a desktop. And hence it is shown the desktop version of the website - as requested. Working as intended.

My advice is - do not go in this direction as it will be a never ending story. It cannot be fixed. Change the website to not rely on detecting iPads correctly.

The only partially reliable way to detect the right device is in the frontend - e.g. something like this:

<script type="text/javascript">

    if(iOS()){
        alert('iOS');
    }

    function iOS() {
            return [
                    'iPad Simulator',
                    'iPhone Simulator',
                    'iPod Simulator',
                    'iPad',
                    'iPhone',
                    'iPod'
                ].includes(navigator.platform)
                // iPad on iOS 13 detection
                ||
                (navigator.userAgent.includes("Mac") && "ontouchend" in document)
        }
</script>

Here it looks for "ontouchend" as that indicates a touch screen eventhough it says it is a desktop mac. If an iPad is detected, you have to reload the page and change the devicetype using the querystring parameter....

But - if you want to stay sane, rethink why a row should only exisst on iPad (next issue is - iPad vertical vs horistonal view)

BR Nicolai

Votes for this answer: 1
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

I have added an article on the doc site related to device detection: https://doc.dynamicweb.dev/documentation/fundamentals/faq/device-detection.html

Votes for this answer: 1
 
Marie Louise Veigert
Reply

Thanks for the input Nicolai!

The main thing is, that they have mainly iPad users for the site on daily basis and want the site to be rendered optimized for ipads when on ipad.
But its, as you say, a complicated issue.

I will look into the above and consider wether its needed :)

 

BR Marie Louise

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

If it is a known group of people, they can change their iPads to not request desktop site: 

How to view the desktop version of a site in Safari

 

You must be logged in to post in the forum