Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill react create ref #4182

Merged
merged 13 commits into from Mar 6, 2018

Conversation

Markionium
Copy link
Member

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

Adds createRef polyfill to prepare for object refs and to have typed refs.

Focus areas to test

(optional)

* master: (28 commits)
  Scrollable pane sort stickies (microsoft#4111)
  Allow ScrollablePane to accept native properties. (microsoft#4095)
  Sticky (microsoft#4091)
  Applying package updates.
  [ColorRectangle, Sticky] Fixed null root refs (microsoft#4099)
  DatePicker: order of callbacks for onSelectDate and onAfterMenuDismiss (microsoft#4092)
  Applying package updates.
  Alhenry fix split button props (microsoft#4090)
  Fixing ComboBox styling by reverting button classname move (microsoft#4088)
  Update CODEOWNERS
  Undoing terrible change.
  [DetailsList] Fixed focus test (microsoft#4087)
  Added icons package screener test (microsoft#4082)
  ContextualMenu: Fix ContextualMenuUtility imports (microsoft#4085)
  [ContextualMenu] Made disabled buttons focusable (microsoft#4074)
  Convert Check to mergeStyles (microsoft#3880)
  [DetailsList] Add public focusIndex function (microsoft#3852)
  ComboBox button should have data-is-focusable="false" (microsoft#4070)
  Applying package updates.
  Focus Zone: Allow Tab to Skip Selection (microsoft#4061)
  ...
…c-react into polyfill-react-createRef

* 'master' of https://github.com/OfficeDev/office-ui-fabric-react:
  ComboBox: Fixed input overlap rendering issue (microsoft#4102)
* master: (51 commits)
  Applying package updates.
  No unused variable (microsoft#4173)
  Use correct _list ref string (microsoft#4168)
  Nav: wire a link to expand/collapse behavior if it has no URL but has children (microsoft#4171)
  Addressing Issue microsoft#4147 - Nav Buttons have invalid `aria-describedby` value (microsoft#4159)
  Fix issue 3608: DetailsList horizontal scroll (microsoft#4164)
  Update package.json
  Image SCSS to MergeStyles Part 2: Style Conversion (microsoft#4151)
  Applying package updates.
  [SpinButton] Consistent styles to Button and TextField (microsoft#4098)
  ChoiceGroup: Flex layout for image and icon options (microsoft#4137)
  Initial set of Keytips work in experiments (microsoft#4062)
  Updating tsconfig in button bundle.
  BaseExtendedPicker: Create contextmenu for renderedItem, fix auto focus (microsoft#3954)
  Dropdown: Custom render options for multiselect - Bug fix microsoft#3571  (microsoft#3589)
  Fix documentcard theming (microsoft#4155)
  BasePicker: Fix not used onBlur callback of inputProps (microsoft#4000) (microsoft#4131)
  Allow Elements as Callout targets (microsoft#4134)
  CommandBar: Fixed null commandItemWidths (microsoft#4136)
  add check for when this.suggestionElement may be undefined (microsoft#4157)
  ...
@@ -42,7 +42,7 @@ export interface ITodoFormState {
* Button: https://fabricreact.azurewebsites.net/fabric-react/master/#/examples/button
*/
export default class TodoForm extends BaseComponent<ITodoFormProps, ITodoFormState> {
private _textField!: ITextField;
private _textField: RefObject<ITextField> = createRef<ITextField>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to type this? Isn't it inferred by the assignment?

"changes": [
{
"comment": "",
"packageName": "@uifabric/experiments",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all change "none" can be deleted.

@@ -43,8 +44,8 @@ export class BaseButton extends BaseComponent<IBaseButtonProps, IBaseButtonState
split: false,
};

private _buttonElement: HTMLElement;
private _splitButtonContainer: HTMLElement;
private _buttonElement = createRef<HTMLElement>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! see, there is no reason to type the refs. It should be implied.

Copy link
Member Author

@Markionium Markionium Mar 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, we should discuss this one though as it's related palantir/tslint#711 as i'm running into it when enabling typedef. (In the case of typedef it would require it ;))

@dzearing dzearing merged commit 25e736f into microsoft:master Mar 6, 2018
Markionium added a commit to Markionium/office-ui-fabric-react that referenced this pull request Mar 6, 2018
* master:
  Applying package updates.
  Polyfill react create ref (microsoft#4182)
  [Pickers] Add async debounce option to BasePicker (microsoft#4163)
  Facepile conditionally rendering aria-describedby (microsoft#4183)
  Applying package updates.
  Addressing Issue microsoft#4174 - 5.59.0 crashing in <ImageBase> (microsoft#4185)
  Website fix: Remove PureComponent (microsoft#4186)
  Add Keytip and KeytipLayer to experiments export (microsoft#4184)
chrismohr pushed a commit to chrismohr/office-ui-fabric-react that referenced this pull request Apr 17, 2018
* Initial implementation of React.createRef polyfill

* Updates based on feedback

* Updates to components with refs

* Fix Type

* Fix lint

* Revert to original Experiment

* Fix typing

* Add typedef to docs

* Add change files

* Remove empty change files
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants