mozilla :: #fx-team

19 Mar 2017
18:28manotejmekamattn: Are you available? I have few questions regarding auto complete.
20:02MattNmanotejmeka: I am now
20:05manotejmekaMattN: can I text you with my questions in 20 min. I am outside and on my phone.
20:42manotejmekamattn: Jaws game me these links http://searchfox.org/mozilla-central/source/toolkit/components/passwordmgr/LoginManagerContent.jsm#1403, http://searchfox.org/mozilla-central/source/toolkit/components/passwordmgr/LoginManagerContent.jsm#1449, https://developer.mozilla.org/en-US/docs/Mozilla/How_to_implement_custom_autocomplete_search_component To build a
20:42manotejmekadrop down selector for search to have search suggestions and I am confused how to implement it. As you can see in this video https://youtu.be/JTCkd_w-7-k I already collect the list of word suggestions when searching for things. I just need to know how I can use that list to build a auto compelete drop down menus so users can just select that word or type it
20:42manotejmekaout as they wish
20:44manotejmekagave me **
20:45MattNmanotejmeka: I&#39;m not 100% sure if it will work in a XUL document but you probably don&#39;t need any of that and can instead use the web standard way: <input list=&quot;foo&quot;/><datalist id=&quot;foo&quot;><option></option></datalist>
20:45MattNyou need to populate the suggestions as <option>s in the <datalist> element
20:46MattNmanotejmeka: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist
20:46MattNsee the example there
20:48MattNthe browser will auto-filter the suggestions in a simple way. That won&#39;t work well if you need custom filtering though
20:48manotejmekaWhat do you mean by custom filters ?
20:48* MattN is considering improvements to input@list as an intern project
20:48MattNhow you filter the results in the suggestions
20:49MattNif you don&#39;t just want substring matching
20:49manotejmekaI have a Trie Tree that searches for words and make a set of all the possible suggestions
20:50manotejmekamattn: https://reviewboard.mozilla.org/r/118094/diff/1#index_header That is how I did that
20:52MattNmanotejmeka: This is how @list results are filtered: https://dxr.mozilla.org/mozilla-central/rev/d29f84406483c721a13cf9a52936ecced0c5c98a/toolkit/components/satchel/nsFormAutoComplete.js#364-371
20:52manotejmekaThe way the input knows that list to use is by the &#39;<input list=&quot;browsers&quot;..&#39; and &#39;<datalist id=&quot;browsers&quot;&#39; id of datalist have to match?
20:52MattNusing a case-insenstive substring match
20:52MattNyes
20:52* MattN looks at the patch
20:54manotejmekaThat is similar what I do in my Tries implementation. I believe there are about 300 unique words and as I search I build a list of search suggestions according to partial words and spelling errors.
20:55MattNright, so what I&#39;m saying is that the code I linked filters the datalist results so it would filter out spelling corrections since it&#39;s looking for exact substring matches
20:55MattNit&#39;s debatable whether the browser should do its own filtering
20:56MattNYou may be able to hack around this or we can add a way to opt-out of the browser filteirng
20:57manotejmekaWell let me get one concept.
20:57MattNThis stuff was just recently modifed in the HTML spec: https://github.com/whatwg/html/commit/e13124544e571f69ae283225c3ea17f209f986a7
20:57manotejmekaShould the datalist list be populated with all words searchable or do I need to dynamically add and remove options according to the searched phrase?
20:57MattNI&#39;m saying that if you provide a suggestion of &quot;friefox&quot; when the user typed &quot;fire&quot; that the browser won&#39;t show the &quot;friefox&quot; result from the datalist since it doesn&#39;t contain &quot;fire&quot;
20:58MattNmanotejmeka: it should work either way but Fx does it&#39;s own filtering last
20:58MattN^ note the intentional typo in my example
20:58manotejmekaI see what your saying.
21:00manotejmekaI am not sure if the datalist is a good approach. What I have is that if you do search for fire all the words related to it like &quot;fire&quot;, &quot;fires&quot;, &quot;firefox&quot; all will be shown with the Tries implementation I have done. What I need is just the front end ingetration I want a way to display those options as drowdown suggestions. How might I be able to do that.
21:00manotejmekais the person searches and added ones more character my tries implementation already takes care of searching for new words and creates a list of autocompelete words
21:00MattNmanotejmeka: right, I didn&#39;t know you were doing advanced stuff like that
21:00MattN(initially)
21:01MattNAnd I was trying to push you to use standard HTML instead of proprietary stuff
21:01MattNsince we&#39;re moving in that direction
21:01manotejmekaSorry if I did not illustrate that in the video but that is what is it during
21:01manotejmekadoing*
21:02manotejmekaSo, what might you say is the best method to take the list of suggestions I computed and display them in the front-end as dropdown clickable suggestions?
21:03manotejmeka mattn:^
21:07MattNmanotejmeka: since I really think we should try to use the web-standard stuff I think you should use datalist but add a non-standard attribute to say that you want to do your own filtering. It&#39;s also less code the standard way
21:08MattNIt would just be a matter of checking an attribute on `aField` at https://dxr.mozilla.org/mozilla-central/rev/d29f84406483c721a13cf9a52936ecced0c5c98a/toolkit/components/satchel/nsFormAutoComplete.js#367
21:08MattNand also checking that the element has the system principal so that we don&#39;t expose that yet to normal webpages
21:10MattNe.g. check something like @listcustomfilter on the input
21:10MattNif @listcustomfilter is present on the input then we use all suggestions in the <datalist>
21:11manotejmekaIs there an example for implementing custom filtering. I think I get the concept a little but not sure how to implement it. I am looking through the link you sent me.
21:12MattNmanotejmeka: you already implemented the filtering logic you would just have to update the <option> in the <datalist> based on your result
21:12MattNone <option> per suggestion
21:12MattNto check we&#39;re in a chrome document: Services.scriptSecurityManager.isSystemPrincipal(aField.nodePrincipal);
21:13MattNmanotejmeka: https://www.raymondcamden.com/2012/06/14/example-of-a-dynamic-html5-datalist-control
21:13manotejmekaSo what your saying is everything I make a list of suggestions I will destroy the datalist make a new one with the options I need and would have a attribute in datalist element that would override to show all the options possible
21:14MattNyeah, I wouldn&#39;t destroy the <datalist> just the contents
21:15* MattN wonders if we support @disabled or @hidden on <option> to handle hiding in <datalist>
21:15MattNIf not we could consider @hidden maybe and get the spec updated?
21:15MattNthat way you just need to toggle the visibility of the suggestions
21:16MattNIf we don&#39;t want to use an attribute to toggle <datalist> suggestions then perhaps just moving the <option> between a placeholder parent and <datalist> would be more performant
21:16MattNsince it avoids the createElement
21:18* nhnt11 wonders if MattN is still around
21:18MattNnhnt11: yes
21:18manotejmekaI am wondering in IRC how do you to this &quot; MattN wonders if we support @disabled or @hidden on <option> to handle hiding in <datalist>&quot;?
21:18MattNuse &quot;/me&quot; to start the message
21:19MattNit will substitute your nick at the beginning
21:19* manotejmeka Testing
21:19manotejmekaOh I see
21:19MattN
21:19nhnt11oh, the joy of discovering IRC
21:19nhnt11:D
21:19* manotejmeka What a (child) noob I am :)
21:20* nhnt11 slaps manotejmeka with a large trout
21:20MattNmanotejmeka: you normally want to have a verb after /me
21:20nhnt11manotejmeka: sorry, that wasn&#39;t hostile :)
21:20nhnt11http://www.urbandictionary.com/define.php?term=trout%20slap
21:20manotejmekamattn: Hiding things and unhiding might make things complicated so I will try to just remove all options and recreate them which might be easier
21:21MattNmanotejmeka: fine for a 1st step
21:21MattNwe can optimize later if needed
21:21manotejmekanp nhnt11:
21:21nhnt11MattN: HELP! I was poking at https://bugzilla.mozilla.org/show_bug.cgi?id=1345687, and am stuck.
21:21firebotBug 1345687 NEW, nobody@mozilla.org [Regression] Clicking on audioVideoButton / sharing-icon don&#39;t work when typed on urlbar
21:22nhnt11I have more details, hold on
21:22nhnt11also it&#39;s nearly 3am so forgive me if I sound off :P
21:23nhnt11so the problem is, once the pageproxystate is invalid, the identity box isn&#39;t clickable anymore
21:23nhnt11i.e. gIdentityHandler in browser.js doesn&#39;t receive click events
21:24nhnt11I&#39;m having trouble finding where clicking is disabled
21:24nhnt11where in the code path I mean
21:24nhnt11I spent half an hour with the js debugger to try and examine all the stuff that happens after deleting the contents of the URL bar
21:24* MattN doesn&#39;t fully understand the bug after reading it
21:25manotejmekaMattn: Thanks for the help and I will implement that. Also, just so you know tacking the subDialogue issue by reading the .dtd and .properties file was a disaster. I implemented it and came to a big road block so mconley suggested might be a best idea to index to a file the contents of subDialogues during build time.
21:25manotejmekaThe reason it was a disaster was because many times the subDialogues were linked to preferences.properties files which has a lot of references to many .xul files and hard to parse out the certain section for just the subDialogue I am in. Right now there is no references to saying these certain attributes are part of such and such subDialogues
21:25MattNnhnt11: the STR in comment 0 don&#39;t match my experience on Nightly
21:25nhnt11MattN: the goal of the bug is that if a site has been granted a permission, clicking the identity box should &quot;work&quot; even if the url bar value has changed
21:25nhnt11and &quot;work&quot; means reverting the URL bar
21:26nhnt11hmm, I was able to reproduce yesterday on my local build
21:26nhnt11oh
21:26nhnt11I can&#39;t reproduce &quot;Firefox window blinks (looses focus, then gets focus)&quot;
21:26nhnt11But &quot;Panel with site permissions should open&quot; doesn&#39;t work
21:26MattNmanotejmeka: I see. Didn&#39;t know about https://dxr.mozilla.org/mozilla-central/source/browser/locales/en-US/chrome/browser/preferences/preferences.properties
21:27MattNMakes sense
21:27nhnt11btw, if you&#39;re busy helping manotejmek_a feel free to shoo me away :)O
21:27nhnt11:) *
21:27MattNI agree that the build step like we previously discussed is best
21:28MattNnhnt11: I don&#39;t understand &quot;3. Click on the right side of floating block with camera/microphone permissions&quot;
21:28MattNdo they mean left?
21:28MattNin LTR
21:28MattNand &quot;floating block&quot; isn&#39;t clear
21:29* nhnt11 is now confused
21:29MattNis that referring to the panel or identity block?
21:29nhnt11I didn&#39;t look at that closely enough to realize that it&#39;s unclear
21:29nhnt11I looked at comment 1
21:29nhnt11And from that I automatically assumed they meant the identity block
21:29nhnt11I might be wrong
21:29MattNRight, I saw johannh&#39;s interpretation but I&#39;m not sure that&#39;s what comment 0 is about :)
21:30MattNanyways I guess I can still try find an answer for you
21:30johannhoh hai
21:30nhnt11\o/
21:30* johannh reading backlog
21:30nhnt11everyone is here
21:30MattNjohannh: trying to parse https://bugzilla.mozilla.org/show_bug.cgi?id=1345687#c0
21:30MattN&quot;3. Click on the right side of floating block with camera/microphone permissions&quot; makes no sense to me
21:30nhnt11unexpected token after &quot;floating block&quot;
21:30nhnt11ignore that^
21:30MattNand s/right/left/?
21:31nhnt11brb, I need some watermelon
21:31nhnt11it&#39;s 24C at 3am... pff
21:31MattNjohannh: anyways, not important if you&#39;re sure you interpretted the report correctly
21:32johannhyeah why floating block, I didn&#39;t think about that
21:33johannhoh that thing
21:33MattNoh, the Windows thing?
21:33MattNah, I think so
21:34MattNsame problem with the mac menubar widget
21:34johannhok then I slightly misinterpreted the bug, but it doesn&#39;t really change that fact that we should cancel urlbar state and show the identity popup I guess
21:34MattNyeah, probably the same outcome
21:34johannhbut that makes it easier for nhnt11
21:34MattNthe bug makes a lot more sense now
21:35johannhnhnt11: sorry for the confusion, we should just fix up that windows thing and the osx indicator
21:35johannhis there something like that for ubuntu?
21:35johannhor any other linux
21:35MattNprobably
21:35MattNI suspect it&#39;s the same as Windows
21:36MattNflorian implemented those IIRC
21:37* nhnt11 is still confused
21:37nhnt11how is it easier for me?
21:37* MattN didn&#39;t understand that either
21:38* nhnt11 is afraid of staining his keyboard pink
21:38johannhwell you don&#39;t have to find a way to get the click events on the (i) icon
21:38nhnt11oh
21:39nhnt11do you mean, reset the urlbar, and show the identity panel, when the button in the &quot;floating block&quot; is clicked?
21:39nhnt11or the mac menubar widget or whatever
21:39johannhthat&#39;s what I meant, but yeah, showing the popup while in pageproxystate=false might still be a challenge, not really sure
21:39nhnt11I don&#39;t think so
21:39johannhyes, we should rather do that
21:39MattNnhnt11: did you look into https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#161,169 ?
21:40johannhMattN: that&#39;s only for popupnotifications afaik
21:40MattNjohannh: well it gets called in this case
21:40MattNwhen I click
21:40nhnt11I don&#39;t think that&#39;s the issue
21:41MattNsince we alternate between the (i) and mic
21:41johannhbut not for checking the identity popup
21:41nhnt11We an always unfocus the url bar
21:41MattNsorry, I mean if we click the (i) so not the exact case
21:41nhnt11the problem is that the identitybox never receives click events if pageproxystate is invalid, even if urlbar doesn&#39;t have focus
21:42johannhwhy did I think that person meant clicking on the sharing indicator? I&#39;m sure I talked about this with florian and he had the same impression, weird
21:42nhnt11hmm, well I can reproduce the original bug description
21:42nhnt11i.e. &quot;Firefox window blinks (looses focus, then gets focus)&quot;
21:42MattNnhnt11: I hit https://dxr.mozilla.org/mozilla-central/rev/e1576dd8bd9d3a4ca418cf347133b8a4957ddeca/browser/base/content/browser.js#7392 when using the mac menubar
21:43nhnt11MattN: yup, I know that line
21:43johannhnhnt11: yeah we should just fix that and ignore my suggestion about clicking the (i) icon
21:43nhnt11That was the line I attempted to change
21:43nhnt11however, that function never got called
21:43MattNI&#39;m telling you it does for me :)
21:43nhnt11yes, yes
21:43nhnt11cool
21:44MattNwhen choosing &quot;Control Sharing&quot; from the menubar widget (which is what I think the bug is actually about, not sure about the OS)
21:44nhnt11I guess this indeed makes it easy for me :D
21:45MattNmanotejmeka: we didn&#39;t want to do the other approach I suggested which was to manually populate the index and have a browser-chrome test to verify that new strings are added?
21:46MattNThat means we don&#39;t actually have to implement this during the build but it still enforces that people don&#39;t forget to update the index
21:46MattNI don&#39;t feel strongly either way but it&#39;s an option to keep in mind still
21:46MattNin case the build step has problems
21:49nhnt11what&#39;s the right way to revert the urlbar?
21:50MattNsee what ESC does maybe? That may be deep in autocomplete code though
21:50johannhnhnt11: in case you&#39;re looking for the global indicator, I think that&#39;s the one: http://searchfox.org/mozilla-central/source/browser/modules/webrtcUI.jsm#846
21:51nhnt11MattN: yeah, I remember finding something when I was following the debugger but I can&#39;t remember
21:51nhnt11I guess I&#39;ll fire it up again
21:51nhnt11johannh: I don&#39;t think I need that :)
21:52johannhoh, ok, yeah, maybe
21:52johannhin fact it just calls identitybox.click()
21:52johannhhttp://searchfox.org/mozilla-central/source/browser/modules/webrtcUI.jsm#164
21:52nhnt11modifying this should work: https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#
21:52nhnt11I&#39;ve already changed that early return to depend on if sharingState
21:52manotejmekaSure will keep that idea in mind
21:52nhnt11s/if//
21:52johannhmodifying browser.js? yeah that should work :P
21:53nhnt11I think it&#39;s an ok solution
21:53nhnt11&quot;clicking the identity box should revert the urlbar and open the panel if we&#39;re sharing something&quot;
21:53johannh(I think you didn&#39;t include the line number at the end)
21:53nhnt11oh crap
21:53nhnt11https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#7392
21:54johannhaha, yeah, that should work
21:54nhnt11just need to figure out an elegant way to reset the urlbar
21:55johannhweeelll technically do you need to still?
21:55johannhI mean this is an entirely different situation
21:56MattNI thought people wanted to to avoid spoofing
21:56nhnt11johannh: OK so for some reason I thought we wanted to revert the urlbar to ensure that the current page url is shown to the user when the identity popup is shown
21:56MattNsince the origin isn&#39;t shown otherwise
21:56MattNbut I guess the user already allowed for the site
21:56MattNso they already had a chance to verify the origin
21:56nhnt11yeah
21:57* nhnt11 is grateful for watermelons
21:57johannhit&#39;s a completely different UI element to show it, it&#39;s not the &quot;normal&quot; way a user would try to open the identity UI
21:57johannhbut idk, maybe it&#39;s safer to revert it
21:58johannhwhy ?
21:58johannhnhnt11: yes that&#39;s still the case, I just think we should at least re-evaluate it
21:59nhnt11
21:59nhnt11 >
21:59nhnt11johannh:
22:00nhnt11I think matt is right in that spoofing isn&#39;t too much of a concern after the permission has already been granted
22:00nhnt11and for this particular case, I don&#39;t think it&#39;s a big deal at all if the url bar isn&#39;t reverted
22:00nhnt11however
22:00nhnt11what&#39;s nagging me is if we change the code in that event handler
22:00nhnt11in the future, if the identity-box becomes clickable for some reason
22:01nhnt11we don&#39;t have that check anymore
22:01johannhhrm
22:01nhnt11so I think we should be decide if we&#39;re ok with that possibility
22:02johannhI thought &quot;spoofing isn&#39;t too much of a concern&quot; a couple of times already and Gijs wasn&#39;t really happy about it
22:03nhnt11was this even with the condition that the user has already granted a permission?
22:03johannhoh, right, heat, haha
22:03johannhit was so cold in Berlin today, dammit, I don&#39;t even remember hot weather once existed
22:04nhnt11forecast predicts it&#39;ll only get worse: https://weather.com/en-IN/weather/10day/l/INKA0908:1:IN
22:04nhnt11:(
22:04* nhnt11 isn&#39;t looking forward to >35C
22:05johannhwow I think you&#39;re as far away from an ocean as possible in India
22:05nhnt11johannh: Bangalore actually is known for its great weather
22:05nhnt11or it was
22:05nhnt11It has gotten much warmer over the last few years
22:05nhnt11highs through the year used to vary between 20-30C
22:05nhnt11Now it hits 38...
22:06johannhdamn
22:07nhnt11https://en.wikipedia.org/wiki/Bangalore#Climate
22:07johannhanyway, no, this wasn&#39;t in that permissions context
22:07* johannh needs to sleep over this
22:08johannhit&#39;s pretty late for me now, since we figured out the main problem I&#39;ll just head to bed
22:08nhnt11ok
22:08nhnt11cool
22:08* nhnt11 should head to bed too
22:08* johannh was about to say that :P
22:08nhnt11good night! :)
22:09johannhgood night
20 Mar 2017
No messages
   
Last message: 4 days and 8 hours ago