Focussing a WebView after a MessageDialog is closed

I've got a contentEditable based
editor within a WebView in
my Windows Store app. Certain keyboard shortcuts and buttons can cause a MessageDialog to
open (intentionally). When this dialog is dismissed, the editor no longer has focus. I've tried setting focus every way I know, and it won't work. Here's a sample app which illustrates the issue
MainPage.xaml
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<WebView x:Name="Editor" Margin="200"></WebView>
</Grid>
<Page.BottomAppBar>
<CommandBar x:Name="CommandBar_Editor" Visibility="Visible">
<AppBarButton Label="Debug" Icon="Setting">
<AppBarButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="show dialog, then focus" Click="MenuFlyoutItem_Click_1"/>
</MenuFlyout>
</AppBarButton.Flyout>
</AppBarButton>
</CommandBar>
</Page.BottomAppBar>
</Page>
MainPage.xaml.cs
public sealed partial class MainPage : Page
public MainPage()
this.InitializeComponent();
protected override void OnNavigatedTo(NavigationEventArgs e)
base.OnNavigatedTo(e);
Editor.NavigateToString("<script type='text/javascript'>function focus_please(){ document.getElementById('editor').focus(); }</script><div id='editor' contentEditable='true'>It was the best of times, it was the worst of times</div>");
private async void MenuFlyoutItem_Click_1(object sender, RoutedEventArgs e)
MessageDialog dialog = new MessageDialog("this should set focus to editor on close", "test");
UICommand okCommand = new UICommand("OK");
dialog.Commands.Add(okCommand);
IUICommand response = await dialog.ShowAsync();
if (response == okCommand)
await Window.Current.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
Editor.Focus(FocusState.Programmatic);
await Window.Current.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
Editor.InvokeScript("focus_please", null);
The code above will work if the user is using the touch interface. That is, if the message dialog is dismissed with a touch, the div within the WebView focusses. 
However, if the user is using Mouse / Keyboard and clicks to dismiss the dialog, the div will not focus.
Is this a bug in WinRT? Is there any known workaround? 

Hi Roryok - I worked on this issue when you had the StackOverflow question.  I could not get it to work only sometimes.  I am going to file a bug on this issue.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces.

Similar Messages

  • Bug Report : Upgraded to Firefox v10. Holding CTRL+ [F4] too long after all tabs are closed causes error. "Exc in ev handl: TypeError: this.oPlg.onTabClosed is not a function"

    Bug Report :
    Upgraded to Firefox v10. Holding CTRL+ [F4] too long after all tabs are closed causes error.
    "Exc in ev handl: TypeError: this.oPlg.onTabClosed is not a function"

    What extensions do you have? (Go to Firefox > Customize > Add-ons to see or Help > Troubleshooting info for a copy-pasteable list)

  • Reversal is only possible after CO month end closing

    I am getting the error Reversal is only possible after CO month end closing while doing partial or full confirmation. I had already checked the OKP1 the period is open. Also in MMRV it is fine. Please suggest what could be the reason for this error.
    With Regards
    Tarun

    HI
    Yes u are right it is a custom message starting with Z. The message is as below:
    Msg.typ Application Area     MsgNo Name of Area of Responsibility Spec.ResAr Number   Numer.
    Order        Seq.   OpAc
    Message Text
    E       Z1                   025                                                  1        1
    Reversal is only possible after CO-month end closing !
    In detail analysis the only details are
    Reversal is only possible after CO-month end closing !
    Message no. Z1025
    Also when i do the back button the message i am getting is
    Error in determining actual costs for order. The detail analysis for the same is
    Error in determining actual costs for order 70076492
    Message no. RU085
    Diagnosis
    The actual costs could not be determined correctly due to incorrect or missing data.
    System Response
    The determination of actual costs is terminated.
    However, the confirmation itself can be saved. Error records are written for a subsequent determination of actual costs. Using these error records, the determination of actual costs can be repeated once the original causes of the errors have been removed.
    The transaction COFC for reprocessing the determination of actual costs can be found, for example, using the menu options "Logistics -> Production -> Production Control -> Confirmation -> Reprocessing -> Actual Costs."
    However, it is not possible to write error records for run schedule headers, QM orders or header confirmations. In this case, the confirmation transaction must be terminated because a subsequent determination of actual costs is not possible.
    Procedure
    You can find the exact cause of the termination of the determination of actual costs in the error log for actual cost determination.
    You can switch the error log on and off using the variable parameters.
    With Regards
    Tarun
    With Regards
    Tarun

  • Saved my Photoshop file after merging layers then closed Photoshop, can I restore back to how I had it?

    Hello,
    I saved a really important client Photoshop file after merging layers then closed Photoshop, can I restore back to how I had it before I merged the layers? or just back a day or two..it's been a couple hours.

    No, unless… you are on a Mac and have Time Machine backups, or can restore your Windows box back to an earlier poit in time.
    But there's nothing within the Photoshop application itself to help you once you save and close a file,

  • After installing Firefox then closing it, I cannot open it, PC says it has been cancelled due to restrictions on my computer

    I have run Firefox for over a year now. However I ended up with various pop-ups recently though they were easy enough to remove and didn't effect Firefox in any obvious way. In the past few days every time I have attempted to open Firefox, even right-clicking on the .exe file a warning pops-up saying "the operation has been cancelled due to restrictions in effect on this computer. please contact your system administrator".
    I uninstalled and reinstalled Firefox and it worked fine, only to return to that warning message after I closed and re-opened it. This has also effected Google Chrome in the exact same way even though I never owned Chrome until all this business began. Internet Explorer, which I'm on now has suffered no problems.

    Do a malware check with some malware scanning programs on the Windows computer.<br>
    Please scan with all programs because each program detects different malware.<br>
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Itunes v10.5.2 will not re-open after using it and closing it once on my Windows XP computer.

    After installing the latest version of itunes, v10.5.2, on my Windows XP computer, I find that once I close itunes, it will not re-open until I restart my computer.  The itunes icon remains in my system tray and is unresponsive.  The only way I can use itunes after opening and closing it once is to restart my computer.  I've checked for updates and support guidance on itunes.com to no avail.  I've even tried uninstalling and reinstalling and it did not fix the problem.  I was not having this problem with the previous version of itunes.  Any advice.

    Have you tried the following option also?:
    - Close the frozen itunes using task manager
    - In task manager go to the 'process' tab
    - Find and select 'APSDaemon.exe'
    - Click 'end process' then close the task manager
    - Re-open iTunes.
    With thanks to user 'Melboredom'

  • Is it possible to keep Firefox open after all windows have closed (and to additionally open a new window when starting another Firefox process)?

    Yes, yes, I know, it's not good to keep applications open when they aren't designed to be. I'm sure Firefox has some memory leaks and this is doing more harm than good, but...
    My computer isn't the greatest out there, and to increase the usability of my Firefox browser it would be nice to keep the firefox.exe process open, even after closing all windows. I know Firefox doesn't totally close if there is at least one Firefox-related window open, but having to open X popup window seems a bit extreme to get this effect.
    Additionally, to allow another window to be opened, it would be cool for the "OH NO FIREFOX IS STILL OPEN" prompts to be replaced with just attempting to open a new window, if this feature is enabled.
    So, if it exists already, is there a config variable for it, and if it doesn't exist, is it possible to perform somehow? I'm not afraid to get my hands dirty if it comes to it; I'd really like to get this happening.
    I'm running Windows 7 Home, if it matters. (I'd rather be running another OS, but this is neither the time nor place...)

    LINK: https://addons.mozilla.org/en-US/firefox/addon/minimizetotray-revived/

  • Let addon run even after browser window is closed.

    I want to use this addon - "Pushbullet" even after the browser window is closed. Such an option was available in Chrome when I used it last. I migrated to Firefox recently, and would like to know how to implement the same here.
    Thanks,
    Raj

    FredMcD, You have been here long enough to know there is a "Edit This Post" link on right of your posts as three posts in a row in short order is too much.
    Some Extensions if you can find the chrome url can be used in shortcut to start a Firefox process but only with the Extension running.
    The ChatZilla irc client extension for instance can or at least used to.

  • Lenovo t61 comes out of standby automatically after the lid is closed

    Hi,
    I have a t61 + wind 7 + 32 bit + ultimate edition. It was working fine till now and suddenly I have noticed its coming out of the standy mode suddenly. I close the lid, its going to standby mode i see the little semi circle on the top and everything is fine. Suddenly when it finds any known wifi signal or any thing, which I think I have noticed, its comes out of stand by ....I can tell that from the beep it makes and the light suddenly goes off. After sometime I notice that the battery dies,  as its in normal mode even when the lid is closed and it consumes all of the battery. Please let me know what settings have to be changed to get rid of this F error. I am facing a lot of trouble as it consumes all of the battery when I open the lid even if its fully charged. I think it has to do with some settings. I have verified everything power manager, wireless adapater etc. Any gurus pls suggest.
    thanks,
    Manu

    a couple things you can check...
    open up Device Manager and see if Allow this device to wake the computer is enabled for your mouse and/or your wired ethernet device on the Power Management tab of their Properties sheets.
    hth.
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество
    Community Resources: Participation Rules • Images in posts • Search (Advanced) • Private Messaging
    PM requests for individual support are not answered. If a post solves your issue, please mark it so.
    X1C3 Helix X220 X301 X200T T61p T60p Y3P • T520 T420 T510 T400 R400 T61 Y2P Y13
    I am not a Lenovo employee.

  • After using FF and closing it will not always reload and requires me to restart my computer, why?

    After running FF and visiting different web sites and then closing down FF it will not restart without a restart of my computer. version 4.
    I have uninstalled and re-installed FF several times to no avail.
    I also have had the problem that when trying to read a complete article on Eurekalert.org I can only do so by opening in another tab rather than just being able to click on it to open.

    https://support.mozilla.com/en-US/kb/Firefox+hangs - see '''Hang_at_exit'''

  • Firefox constantly being unable to open after it has been closed and requires a machine restart

    I have used all of the solutions published and consistently find that I close Firefox, go to reopen it and I get the two standard messages:
    Firefox is already running, but is not responding. The old Firefox process must be closed to open a new window.
    Then:
    Your Firefox profile cannot be loaded. It may be missing or inaccessible.
    Task manager cannot close the application
    the application is not visible in any session
    I have followed all the posted solutions
    I have uninstalled Firefox, shut down, rebooted. shut down again, rebooted, then downloaded a fresh copy of Firefox, run updates, got the messages that says it is fully up to date, and I am still encountering the problem.
    After three days of tackling the issue and countless hours, I'm ready to move to another browser, but do not want to.

    Typically when we see the 'Firefox Process' refusing to close the issue is with a misbehaving plugin, add-on, or toolbar component. I will post a link to the Mozilla Knowledge Base about creating a test profile:
    https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
    Follow the instructions on that page to create a brand new profile for your browser, we will use this to confirm the source of the issues you are having. Use this new profile to browse briefly, then close Firefox and confirm if the issue is still giving you trouble. With the new profile the Firefox Process should end without any issues.
    If this new profile is not having issues, then your problem is most likely with one or more plugins or add-ons installed on your original user profile. If you find that the new profile has fixed your issues, then you can follow the steps labelled under "Removing a profile" to delete the files that were causing issues with your browser. Removing a profile can permanently delete files, so make sure to confirm that the new profile has solved all of your issues before removing a previous profile.

  • IE11 Shows :Program not responding, on Desktop, after IE File is closed out

     Hi, I am looking for help with this odd problem and cannot find any other question like it.
    My PC has Windows 7 64bit installed on HP pavilion g7 notebook. I use 32 bit browser I mostly go to in private as I have to erase all Temp internet files manually.(Different problem)   
      I always open IE , not in private first, and again before I close out to insure some needed      files are in temp internet files. I have done this for 3 years as this PC has a quirk and am       
    telling this just so you have all information. Still EI will close out, as below, no matter what!
    After IE 11 update KB2962872 IE works well but very often after closing out IE file a message appears on my Desktop saying that the program is not responding....looks for solution.....then says to close out IE. But I had already closed it out???? The
    message takes 1 to 3 seconds to appear on my Desktop. Makes no sense and I have tried many things. Tried a compatibility       trouble-shooter and when  I give the file for IE it said this program cannot be tested.
    IE does not show up in Programs and Files , from my control panel?
    Event viewer shows Error:
    Faulty Application name: IEXPLORER.EXE, version:11.0.9600.17207,time stamp:0x53a20c50
    Faulty module name:MSHTML.dll, version:11.0.9600.17207                                               
    Execution code: 0xc0000005                                                                                              
    Faulty offset: 0x00482d4f                                                                                                  
    Faulty process id: 0x18eo                                                                                                  
    Faulty application start time: 0x01cf9df2ac176a84                                                               
    Faulty application path: C\: Program Files (x86)\ Internet Explorer\ IEXPLORE.EXE                  Faulty module path: C:\Windows\system32\MSHTML.dll
    Action center shows this problem and thus my performance is about 2 on 10.
    Thank you very much for looking at my question.       

    Hello Picpansnap & Rob,
      I encountered a similar problem, as Picpansnap did "After IE 11 update KB2962872 IE works well but very often after closing out IE file a message appears on my Desktop saying that the program is not responding....looks for solution.....then
    says to close out IE." This happens now every time I open IE.
    I agree Rob that this is likely a 3rd party add-on problem. In my case I tried the consumer solutions 1st.  I myself did try all the recommended solutions and even ran the good old fixit tool. However I was not ever able to get to Tools>Internet
    Options>Advanced as my browser would crash shortly after opening. This became very frustrating so being an IT professional myself, I of course came to technet to check the forums.  KB2962872 is a recent update at the time of this writing and as such
    the consumer site may not quite be aware of the need for an advanced solution as of yet.  Picpansnap showed some advanced level understanding by sending an event viewer output, it was the similarities between his output and mine as well as your mention
    of 3rd party add-on's that prompted me to remember another method to turn them off as I had tried Tools>Internet Options>Advanced unsuccessfully due to the quick crashing of newly opened IE page.
    I remembered how to diagnose an individual IE add-on so I opened internet properties and from the program tab clicked the manage add-on button and proceeded to disable all IE add-on's and bring them up one by one to see which one was the culprit. In my case
    it was the avast online security add-on that was the cause. With that add-on disabled Internet Explorer is now working fine. I have a subscription to avast internet security and am passing on this information to them as well as to http://answers.microsoft.com
    I would like to wholeheartedly thank both of you for providing me with the clues to get my own IE working again. I had just performed a re-install of Windows 8 due to AMD's 14.4 driver hosing my USB, sound & DVD drive. I was able to get the sound &
    DVD working again without the re-install but after spending hours in forums and trying solutions I was left with the re-install & update all the way back to Win 8.1 as my only option (recovery image was on external USB drive , of course). That was a battle
    and I really do appreciate the posts here in technet where many problems with Microsoft programs are resolved 1st.  I usually am a reader only & this will be my 1st post, I hope this can help others with similar issues.
    Chuck ;)

  • After my case is closed, Adobe haven't sent me the serial no. till now.

    I've opened a case and it closed on 27th Nov. Case #0206977633. It's about the ridiculous so-called "insufficient" student id supporting. However, after Adobe received my last supporting document of my student id on Nov 27th, they closed the case but haven't sent me any serial number afterwards till today. I cannot re-open the case anymore and cannot open any new cases neither. Pls anyone can help?

    Hugo it looks like you were previously denied due to your student ID being expired.  For the best assistance, I recommend our chat support at http://adobe.ly/uOBJh0.  Our chat representatives can provide a personalized experience to resolve the issue you have described.

  • Why does the app (acrobat.exe) stay alive after the document is closed?

    Using system Explorer or HijackThis, it is apparent that the acrobat.exe app stays active after the document that called the app is closed.  Why?  and how do I stop it from happening?

    I have the same problem and it is irritating because if I print and save a pdf file using Acrobat, I cannot change the file name or delete the file  because the system somehow thinks the file is open in the Acrobat.exe application, even after I have closed out pdf file and all Adobe applications in my user account.   I need to go to the Task Manager and find the Acrobat application running under SYSTEM in order to stop the process so I can go back and change the file name or delete it...
    This did not occur until my recent update to Acrobat 9.4.2.220 .  Is this fixable somehow?

  • Prevent entering result recording after the production order closed.

    Hi QM Gurus,
    I want to prevent entering the result recording (we used inspection point) after the corresponding production order was closed.
    Please help.
    Cheers,
    Sun

    hi all,
    Enhancement QEEM0015 is only used for individual result, it can not be used for summerized result.
    Enhancement QEEM0011 is the right one for my case.
    It works before the system valuates the inspectoin characteristics' result for both individual and summerized result.
    Thanks all for your help.
    Regards,
    Sun

Maybe you are looking for

  • Crystal Report Hyperlink to Sub-report or other report

    Hi, I would like to create a report on which the first part will show project summary page. The second part will have all project detail pages and third part with all project financial informations. The report should work in such a way whenever user

  • Manual infiniband installation -  ib_sdp not found

    I've asked oracle support for a guide on how to do this but they aren't being helpful. Before upgrading to 2.6.32-300.7.1.el5uek I had to remove all the infiniband drivers now I'm trying to get it working again. Everything worked previously. Installi

  • Calling Microsoft Word in Java

    I am new to Java. I would like to know is there any way that I can invoke Word or Excel application in my Java program? If yes, how? Thank you in advance for your help.

  • How can I use oracle 9i to connect with my jsp

    Hi, I have a question with my a little final year project. I have been install oracle 9i on Win2000. I also install apache and tomcat on Win98 and it works properly. I am trying to use jsp to develop my homepage and it can be connect with my oracle t

  • Ps not opening after double clicking

    ok i have been using photoshop cs6 since january and it worked fine but now when i double click on the the ps icon, NOTHING HAPPENS! please help me guys thanx in advance