ICommandBarItemProps doesn't support focus method - office-ui-fabric-react

I'm implementing a command bar with several buttons on it. The buttons are of type ICommandBarItemProps and assigned to attribute "items" of . Now I want to set focus for one of the buttons using componentRef for accessibility purpose, but it says cannot find focus() on IContextualMenuRenderItem (IRefObject is the type of componentRef). I checked the doc for this interface and did not found focus() supported. https://developer.microsoft.com/en-us/fluentui#/controls/web/contextualmenu#IContextualMenuRenderItem
How do we set focus on a command bar button with type ICommandBarItemProps?

Related

Changing the default displayAction and playAction labels in tvOS in Top Shelf

On tvOS if you look at the native Music or Arcade app's top shelf area their "play" action has the label of "Watch Playlist" and "Get" respectively. However I don't see a way to edit these values in my own app as the TVTopShelfAction is an NSObject with a single value: URL so I would assume this is just for directing the user based on where the button goes and there's no labelling props available for the container class as well (TVTopShelfCarouselItem).
The docs say: https://developer.apple.com/documentation/tvservices/tvtopshelfaction
"When configuring items for a carousel interface, you can specify a custom title and image for the buttons in that interface. If you do not specify a custom title and image, the system chooses default values based on whether you assigned the action object to the playAction or displayAction property of your item."
But it's unclear if that is referring to the TVTopShelfCarouselItem which the action becomes a part of and what value I should be changing to customize it. So is this something that's hidden in the TVTopShelfCarouselItem's namedAttributes prop? And if so...which one?
I've had this same problem. I've asked Apple about it and they responded that the documentation is wrong. There is currently no way to change the button titles.
There is also no way, that I'm aware of, to display the item's title without the user having to tap for details.
Hopefully in the future this ability is added.
I'd love to know if you find a way.

Difference between Buttons and onTapGesture

I’m quite new to swiftui and I was curious on what’s the difference between using a button displaying an image or an image with onTapGesture modifier that make an action just like the action on buttons.
In the use case you've described you can use either but for reference, Apple provides the following guidance in their documentation for onTapGesture:
If you are creating a control that’s functionally equivalent to a Button, use ButtonStyle to create a customized button instead.
onTapGesture adds an action to perform when the view recognizes a tap gesture and can be tailored to respond to any number of taps (with 1 being the default).
Buttons are a control that performs an action when triggered and have the benefit of automatically adapting their visual style to match the expected style within different containers and contexts.
In iOS and watchOS, the user triggers a standard button by tapping on it.
In macOS, the user triggers a standard button by clicking on it.
In tvOS, the user triggers a standard button by pressing “select” on an external remote, like the Siri Remote, while focusing on the button.
For more information please refer to Apples documentation here: https://developer.apple.com/documentation/swiftui/text/ontapgesture(count:perform:)
https://developer.apple.com/documentation/swiftui/button
I would recommend using Button when you want the feature of a button. I noticed that images cannot be used as buttons with Voice Over on. When I changed those to use Button instead, it fixes the problem.

Assign Radio Group to Radio Buttons

I have several radio buttons
I need to assign a radio group to it so that only one radio button is selectable at a time.There is no radio group option.I have tried
Assigning a single action outlet to all buttons
Putting all buttons in a custom view
None of this works.
In the old days, NSMatrix was the class that provided the radio group behavior. If you look up the docs for that class, you'll find the following note:
Use of NSMatrix is discouraged in apps that run in macOS 10.8 and later. If you need to create a radio button group in an app that runs in macOS 10.8 and later, create instances of NSButton that each specify a button type of NSRadioButton and specify the same action and the same superview for each button in the group.
So there are three things that all need to be true at the same time for this to work:
Your buttons all have to share the same superview.
Your buttons all have to have the same action.
Your buttons need to have their button type set to NSRadioButton.
I tried this out just now. I created a button in a view in my storyboard, set it's button type to "Radio" in the Attributes inspector, and assigned an action. Then I duplicated that button several times, and ran the app. The radio behavior worked automatically.
If it's not working for you, I'd start by doing what I did above. Just create a single radio button and set it up with an action. Then duplicate it a few times and test. If that works (it should), then either see if you can use that technique to get what you want, or look at what's different between what you want and what works.

Custom Work Item Types don't show in any Board or Backlog?

We've created a new work item type called "Improvement", but found that it does not show in any board or backlog - only search. After some digging in settings, I found this:
Can you really not add new work item types and get them into your workflow along side the default types?
In this page, hover with the mouse on the work item level you want to include your custom item and click "Edit":
In the screen that opens you can add the custom work item.

TAB key navigation for sap.m.Table

I have some data input fields inside a sap.m.table. Wanted to use Tab key to navigate to the input fields but it doesn't work.
It seems the SAP application interface hasn't implemented this feature.
I tried with some custom function and not working.
Any solution or alternative for this feature?
SAP itself now come up with the solution. Navigation with the TAB key is available form SAPUI5 version 1.44.
SAP NOTE 2387996 - SAPUI5 unable to use Tab to move to next field.
We have to press F2 key to activate this.
It's no longer necessary to use a custom solution for this. As of SAPUI5 version 1.38.0 sap.m.table has a property called 'keyboardMode' that can be set to 'Edit' which will change the tab behaviour to navigate focus through all editable fields in the table.
This mode is suitable if the number of items is limited and if there
are editable fields within the item.
While the last/first interactive element within an item has the focus,
pressing tab/shift+tab moves the focus to the next/previous element in
the tab chain after/before the item .
https://sapui5.hana.ondemand.com/#/api/sap.m.ListKeyboardMode
Attach browser event
new sap.m.Input({
value:"{first}"
}).attachBrowserEvent("keydown",function(oEvent){
if(oEvent.key == 'Tab'){
alert(this);//this reference to input control
//Your logic here
}
})
Sample JSBIN